migrate service config and composer thread reads to the appview client

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Samuel Newman
2026-08-03 14:57:26 +03:00
parent b3aa00a4d7
commit 935935518a
2 changed files with 29 additions and 22 deletions
+5 -4
View File
@@ -1,7 +1,8 @@
import {useQuery} from '@tanstack/react-query'
import {STALE} from '#/state/queries'
import {useAgent} from '#/state/session'
import {useAppviewClient} from '#/state/session'
import {app} from '#/lexicons'
type ServiceConfig = {
checkEmailConfirmed: boolean
@@ -13,17 +14,17 @@ type ServiceConfig = {
}
export function useServiceConfigQuery() {
const agent = useAgent()
const client = useAppviewClient()
return useQuery<ServiceConfig>({
refetchOnWindowFocus: true,
staleTime: STALE.MINUTES.FIVE,
queryKey: ['service-config'],
queryFn: async () => {
try {
const {data} = await agent.api.app.bsky.unspecced.getConfig()
const data = await client.call(app.bsky.unspecced.getConfig)
return {
checkEmailConfirmed: Boolean(data.checkEmailConfirmed),
// @ts-expect-error not included in types atm
// @ts-expect-error not included in the lexicon atm
topicsEnabled: Boolean(data.topicsEnabled),
liveNow: data.liveNow ?? [],
}