Bluesky app fork with some witchin' additions 馃挮
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

at main 39 lines 985 B view raw
1import {useQuery} from '@tanstack/react-query' 2 3import {STALE} from '#/state/queries' 4import {useAgent} from '#/state/session' 5 6type ServiceConfig = { 7 checkEmailConfirmed: boolean 8 topicsEnabled: boolean 9 liveNow: { 10 did: string 11 domains: string[] 12 }[] 13} 14 15export function useServiceConfigQuery() { 16 const agent = useAgent() 17 return useQuery<ServiceConfig>({ 18 refetchOnWindowFocus: true, 19 staleTime: STALE.MINUTES.FIVE, 20 queryKey: ['service-config'], 21 queryFn: async () => { 22 try { 23 const {data} = await agent.api.app.bsky.unspecced.getConfig() 24 return { 25 checkEmailConfirmed: Boolean(data.checkEmailConfirmed), 26 // @ts-expect-error not included in types atm 27 topicsEnabled: Boolean(data.topicsEnabled), 28 liveNow: data.liveNow ?? [], 29 } 30 } catch (e) { 31 return { 32 checkEmailConfirmed: false, 33 topicsEnabled: false, 34 liveNow: [], 35 } 36 } 37 }, 38 }) 39}