about summary refs log tree commit diff
path: root/src/state/queries/email-verification-required.ts
diff options
context:
space:
mode:
authorHailey <me@haileyok.com>2024-11-12 11:18:53 -0800
committerGitHub <noreply@github.com>2024-11-12 11:18:53 -0800
commit427f3a8bd7f21f14aef32af2f7ccf1f4b2731c29 (patch)
tree4b365327a7438a5d24f880c6cc38bf1a9033fe0c /src/state/queries/email-verification-required.ts
parentdd8d14e133f5f705a4056d95a76542aeea26db28 (diff)
downloadvoidsky-427f3a8bd7f21f14aef32af2f7ccf1f4b2731c29.tar.zst
Add email verification prompts throughout the app (#6174)
Diffstat (limited to 'src/state/queries/email-verification-required.ts')
-rw-r--r--src/state/queries/email-verification-required.ts25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/state/queries/email-verification-required.ts b/src/state/queries/email-verification-required.ts
new file mode 100644
index 000000000..94ff5cbc6
--- /dev/null
+++ b/src/state/queries/email-verification-required.ts
@@ -0,0 +1,25 @@
+import {useQuery} from '@tanstack/react-query'
+
+interface ServiceConfig {
+  checkEmailConfirmed: boolean
+}
+
+export function useServiceConfigQuery() {
+  return useQuery({
+    queryKey: ['service-config'],
+    queryFn: async () => {
+      const res = await fetch(
+        'https://api.bsky.app/xrpc/app.bsky.unspecced.getConfig',
+      )
+      if (!res.ok) {
+        return {
+          checkEmailConfirmed: false,
+        }
+      }
+
+      const json = await res.json()
+      return json as ServiceConfig
+    },
+    staleTime: 5 * 60 * 1000,
+  })
+}