about summary refs log tree commit diff
path: root/src/state/queries/labeler.ts
diff options
context:
space:
mode:
authordan <dan.abramov@gmail.com>2024-05-28 16:37:51 +0100
committerGitHub <noreply@github.com>2024-05-28 16:37:51 +0100
commit9bd411c15159609803c4e8c3e352a9db32ea527c (patch)
tree31305e290bd4597aa6ab441ecc556999b19ad693 /src/state/queries/labeler.ts
parent8a2f43c218c464e6165f331e482b6094b87eefc7 (diff)
downloadvoidsky-9bd411c15159609803c4e8c3e352a9db32ea527c.tar.zst
Replace getAgent() with reading agent (#4243)
* Replace getAgent() with agent

* Replace {agent} with agent
Diffstat (limited to 'src/state/queries/labeler.ts')
-rw-r--r--src/state/queries/labeler.ts18
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() {