diff options
Diffstat (limited to 'src/state/queries/labeler.ts')
-rw-r--r-- | src/state/queries/labeler.ts | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/state/queries/labeler.ts b/src/state/queries/labeler.ts index 359291636..058e8fcde 100644 --- a/src/state/queries/labeler.ts +++ b/src/state/queries/labeler.ts @@ -31,12 +31,12 @@ export function useLabelerInfoQuery({ did?: string enabled?: boolean }) { - const {getAgent} = useAgent() + const agent = useAgent() return useQuery({ enabled: !!did && enabled !== false, queryKey: labelerInfoQueryKey(did as string), queryFn: async () => { - const res = await getAgent().app.bsky.labeler.getServices({ + const res = await agent.app.bsky.labeler.getServices({ dids: [did as string], detailed: true, }) @@ -46,26 +46,26 @@ export function useLabelerInfoQuery({ } export function useLabelersInfoQuery({dids}: {dids: string[]}) { - const {getAgent} = useAgent() + const agent = useAgent() return useQuery({ enabled: !!dids.length, queryKey: labelersInfoQueryKey(dids), queryFn: async () => { - const res = await getAgent().app.bsky.labeler.getServices({dids}) + const res = await agent.app.bsky.labeler.getServices({dids}) return res.data.views as AppBskyLabelerDefs.LabelerView[] }, }) } export function useLabelersDetailedInfoQuery({dids}: {dids: string[]}) { - const {getAgent} = useAgent() + const agent = useAgent() return useQuery({ enabled: !!dids.length, queryKey: labelersDetailedInfoQueryKey(dids), gcTime: 1000 * 60 * 60 * 6, // 6 hours staleTime: STALE.MINUTES.ONE, queryFn: async () => { - const res = await getAgent().app.bsky.labeler.getServices({ + const res = await agent.app.bsky.labeler.getServices({ dids, detailed: true, }) @@ -76,7 +76,7 @@ export function useLabelersDetailedInfoQuery({dids}: {dids: string[]}) { export function useLabelerSubscriptionMutation() { const queryClient = useQueryClient() - const {getAgent} = useAgent() + const agent = useAgent() return useMutation({ async mutationFn({did, subscribe}: {did: string; subscribe: boolean}) { @@ -87,9 +87,9 @@ export function useLabelerSubscriptionMutation() { }).parse({did, subscribe}) if (subscribe) { - await getAgent().addLabeler(did) + await agent.addLabeler(did) } else { - await getAgent().removeLabeler(did) + await agent.removeLabeler(did) } }, onSuccess() { |