diff options
Diffstat (limited to 'src/state/queries/messages/mute-conversation.ts')
-rw-r--r-- | src/state/queries/messages/mute-conversation.ts | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/src/state/queries/messages/mute-conversation.ts b/src/state/queries/messages/mute-conversation.ts index f30612c73..fa760e00d 100644 --- a/src/state/queries/messages/mute-conversation.ts +++ b/src/state/queries/messages/mute-conversation.ts @@ -1,15 +1,14 @@ import { - BskyAgent, ChatBskyConvoDefs, ChatBskyConvoListConvos, ChatBskyConvoMuteConvo, -} from '@atproto-labs/api' +} from '@atproto/api' import {InfiniteData, useMutation, useQueryClient} from '@tanstack/react-query' -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_KEY} from './conversation' import {RQKEY as CONVO_LIST_KEY} from './list-converations' -import {useHeaders} from './temp-headers' export function useMuteConvo( convoId: string | undefined, @@ -22,24 +21,23 @@ export function useMuteConvo( }, ) { const queryClient = useQueryClient() - const headers = useHeaders() - const {serviceUrl} = useDmServiceUrlStorage() + const {getAgent} = useAgent() return useMutation({ mutationFn: async ({mute}: {mute: boolean}) => { if (!convoId) throw new Error('No convoId provided') - const agent = new BskyAgent({service: serviceUrl}) + const agent = getAgent() if (mute) { const {data} = await agent.api.chat.bsky.convo.muteConvo( {convoId}, - {headers, encoding: 'application/json'}, + {headers: DM_SERVICE_HEADERS, encoding: 'application/json'}, ) return data } else { const {data} = await agent.api.chat.bsky.convo.unmuteConvo( {convoId}, - {headers, encoding: 'application/json'}, + {headers: DM_SERVICE_HEADERS, encoding: 'application/json'}, ) return data } |