Explorar el Código

Create new SWR hook for security settings

arvid-e hace 3 meses
padre
commit
09e794f359
Se han modificado 1 ficheros con 11 adiciones y 0 borrados
  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;
+    }),
+  );
+};