diff options
author | Hailey <me@haileyok.com> | 2024-11-12 11:18:53 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-11-12 11:18:53 -0800 |
commit | 427f3a8bd7f21f14aef32af2f7ccf1f4b2731c29 (patch) | |
tree | 4b365327a7438a5d24f880c6cc38bf1a9033fe0c /src/state/queries/email-verification-required.ts | |
parent | dd8d14e133f5f705a4056d95a76542aeea26db28 (diff) | |
download | voidsky-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.ts | 25 |
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, + }) +} |