Use entryway for labeler getServices (#3256)

zio/stable
Paul Frazee 2024-03-18 14:58:02 -07:00 committed by GitHub
parent 20d463ff2f
commit 1b10c7bc08
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 4 deletions

View File

@ -4,7 +4,7 @@ import {AppBskyLabelerDefs} from '@atproto/api'
import {getAgent} from '#/state/session' import {getAgent} from '#/state/session'
import {preferencesQueryKey} from '#/state/queries/preferences' import {preferencesQueryKey} from '#/state/queries/preferences'
import {STALE, PUBLIC_BSKY_AGENT} from '#/state/queries' import {STALE} from '#/state/queries'
export const labelerInfoQueryKey = (did: string) => ['labeler-info', did] export const labelerInfoQueryKey = (did: string) => ['labeler-info', did]
export const labelersInfoQueryKey = (dids: string[]) => [ export const labelersInfoQueryKey = (dids: string[]) => [
@ -27,7 +27,7 @@ export function useLabelerInfoQuery({
enabled: !!did && enabled !== false, enabled: !!did && enabled !== false,
queryKey: labelerInfoQueryKey(did as string), queryKey: labelerInfoQueryKey(did as string),
queryFn: async () => { queryFn: async () => {
const res = await PUBLIC_BSKY_AGENT.app.bsky.labeler.getServices({ const res = await getAgent().app.bsky.labeler.getServices({
dids: [did as string], dids: [did as string],
detailed: true, detailed: true,
}) })
@ -41,7 +41,7 @@ export function useLabelersInfoQuery({dids}: {dids: string[]}) {
enabled: !!dids.length, enabled: !!dids.length,
queryKey: labelersInfoQueryKey(dids), queryKey: labelersInfoQueryKey(dids),
queryFn: async () => { queryFn: async () => {
const res = await PUBLIC_BSKY_AGENT.app.bsky.labeler.getServices({dids}) const res = await getAgent().app.bsky.labeler.getServices({dids})
return res.data.views as AppBskyLabelerDefs.LabelerView[] return res.data.views as AppBskyLabelerDefs.LabelerView[]
}, },
}) })
@ -54,7 +54,7 @@ export function useLabelersDetailedInfoQuery({dids}: {dids: string[]}) {
gcTime: 1000 * 60 * 60 * 6, // 6 hours gcTime: 1000 * 60 * 60 * 6, // 6 hours
staleTime: STALE.MINUTES.ONE, staleTime: STALE.MINUTES.ONE,
queryFn: async () => { queryFn: async () => {
const res = await PUBLIC_BSKY_AGENT.app.bsky.labeler.getServices({ const res = await getAgent().app.bsky.labeler.getServices({
dids, dids,
detailed: true, detailed: true,
}) })