diff options
author | dan <dan.abramov@gmail.com> | 2024-05-28 16:37:51 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-28 16:37:51 +0100 |
commit | 9bd411c15159609803c4e8c3e352a9db32ea527c (patch) | |
tree | 31305e290bd4597aa6ab441ecc556999b19ad693 /src/state/queries/messages/get-convo-for-members.ts | |
parent | 8a2f43c218c464e6165f331e482b6094b87eefc7 (diff) | |
download | voidsky-9bd411c15159609803c4e8c3e352a9db32ea527c.tar.zst |
Replace getAgent() with reading agent (#4243)
* Replace getAgent() with agent * Replace {agent} with agent
Diffstat (limited to 'src/state/queries/messages/get-convo-for-members.ts')
-rw-r--r-- | src/state/queries/messages/get-convo-for-members.ts | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/src/state/queries/messages/get-convo-for-members.ts b/src/state/queries/messages/get-convo-for-members.ts index a260d5416..7979e0665 100644 --- a/src/state/queries/messages/get-convo-for-members.ts +++ b/src/state/queries/messages/get-convo-for-members.ts @@ -18,11 +18,11 @@ export function useGetConvoForMembers({ onError?: (error: Error) => void }) { const queryClient = useQueryClient() - const {getAgent} = useAgent() + const agent = useAgent() return useMutation({ mutationFn: async (members: string[]) => { - const {data} = await getAgent().api.chat.bsky.convo.getConvoForMembers( + const {data} = await agent.api.chat.bsky.convo.getConvoForMembers( {members: members}, {headers: DM_SERVICE_HEADERS}, ) @@ -44,16 +44,13 @@ export function useGetConvoForMembers({ * Gets the conversation ID for a given DID. Returns null if it's not possible to message them. */ export function useMaybeConvoForUser(did: string) { - const {getAgent} = useAgent() + const agent = useAgent() return useQuery({ queryKey: RQKEY(did), queryFn: async () => { - const convo = await getAgent() - .api.chat.bsky.convo.getConvoForMembers( - {members: [did]}, - {headers: DM_SERVICE_HEADERS}, - ) + const convo = await agent.api.chat.bsky.convo + .getConvoForMembers({members: [did]}, {headers: DM_SERVICE_HEADERS}) .catch(() => ({success: null})) if (convo.success) { |