about summary refs log tree commit diff
path: root/src/state/queries/messages/leave-conversation.ts
diff options
context:
space:
mode:
authorEric Bailey <git@esb.lol>2024-05-14 09:22:09 -0500
committerGitHub <noreply@github.com>2024-05-14 09:22:09 -0500
commit9173be686c1df9adc6cbb9cc2175f8909a868c35 (patch)
tree25ea67a686969a086249769a1a3a445cd819a9ff /src/state/queries/messages/leave-conversation.ts
parent107760d551dee695f76409337048cd8c7917b784 (diff)
downloadvoidsky-9173be686c1df9adc6cbb9cc2175f8909a868c35.tar.zst
[🐴] Swap in new package, update usages (#3992)
* Swap in new package, update usages

* Remove uneccessary patch

* Override type in safe place
Diffstat (limited to 'src/state/queries/messages/leave-conversation.ts')
-rw-r--r--src/state/queries/messages/leave-conversation.ts18
1 files changed, 6 insertions, 12 deletions
diff --git a/src/state/queries/messages/leave-conversation.ts b/src/state/queries/messages/leave-conversation.ts
index 5d5c64c5b..d7d47b274 100644
--- a/src/state/queries/messages/leave-conversation.ts
+++ b/src/state/queries/messages/leave-conversation.ts
@@ -1,14 +1,10 @@
-import {
-  BskyAgent,
-  ChatBskyConvoLeaveConvo,
-  ChatBskyConvoListConvos,
-} from '@atproto-labs/api'
+import {ChatBskyConvoLeaveConvo, ChatBskyConvoListConvos} from '@atproto/api'
 import {useMutation, useQueryClient} from '@tanstack/react-query'
 
 import {logger} from '#/logger'
-import {useDmServiceUrlStorage} from '#/screens/Messages/Temp/useDmServiceUrlStorage'
+import {DM_SERVICE_HEADERS} from '#/state/queries/messages/const'
+import {useAgent} from '#/state/session'
 import {RQKEY as CONVO_LIST_KEY} from './list-converations'
-import {useHeaders} from './temp-headers'
 
 export function useLeaveConvo(
   convoId: string | undefined,
@@ -21,17 +17,15 @@ export function useLeaveConvo(
   },
 ) {
   const queryClient = useQueryClient()
-  const headers = useHeaders()
-  const {serviceUrl} = useDmServiceUrlStorage()
+  const {getAgent} = useAgent()
 
   return useMutation({
     mutationFn: async () => {
       if (!convoId) throw new Error('No convoId provided')
 
-      const agent = new BskyAgent({service: serviceUrl})
-      const {data} = await agent.api.chat.bsky.convo.leaveConvo(
+      const {data} = await getAgent().api.chat.bsky.convo.leaveConvo(
         {convoId},
-        {headers, encoding: 'application/json'},
+        {headers: DM_SERVICE_HEADERS, encoding: 'application/json'},
       )
 
       return data