Просмотр исходного кода

Create new SWR hook for security settings

arvid-e 2 месяцев назад
Родитель
Сommit
09e794f359
1 измененных файлов с 11 добавлено и 0 удалено
  1. 11 0
      apps/app/src/stores/security-settings.ts

+ 11 - 0
apps/app/src/stores/security-settings.ts

@@ -0,0 +1,11 @@
+import useSWR from 'swr';
+
+import { apiv3Get } from '~/client/util/apiv3-client';
+
+export const useSWRxSecuritySettings = () => {
+  return useSWR('/security-setting', () =>
+    apiv3Get('/security-setting').then((res) => {
+      return res.data.securityParams.generalSetting;
+    }),
+  );
+};