mirror of https://git.lenooby09.tech/LeNooby09/social-app.git
1import {useQuery} from '@tanstack/react-query'
2
3interface ServiceConfig {
4 checkEmailConfirmed: boolean
5}
6
7export function useServiceConfigQuery() {
8 return useQuery({
9 queryKey: ['service-config'],
10 queryFn: async () => {
11 const res = await fetch(
12 'https://api.bsky.app/xrpc/app.bsky.unspecced.getConfig',
13 )
14 if (!res.ok) {
15 return {
16 checkEmailConfirmed: false,
17 }
18 }
19
20 const json = await res.json()
21 return json as ServiceConfig
22 },
23 staleTime: 5 * 60 * 1000,
24 })
25}