diff options
author | Paul Frazee <pfrazee@gmail.com> | 2023-11-16 18:26:22 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-16 18:26:22 -0800 |
commit | 357c752a213dbcf77e5333fa180cfef20a33842d (patch) | |
tree | e955e57cc1252b5fe759cde29185d62bb71bc339 /src/state/queries/like.ts | |
parent | 3043b324681f1702ca53831701fb5cecd14c0efb (diff) | |
download | voidsky-357c752a213dbcf77e5333fa180cfef20a33842d.tar.zst |
Move the current agent to a global and reset RQ queries on agent change (#1946)
Diffstat (limited to 'src/state/queries/like.ts')
-rw-r--r-- | src/state/queries/like.ts | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/src/state/queries/like.ts b/src/state/queries/like.ts index 187d8fb82..94857eb91 100644 --- a/src/state/queries/like.ts +++ b/src/state/queries/like.ts @@ -1,24 +1,20 @@ import {useMutation} from '@tanstack/react-query' -import {useSession} from '#/state/session' +import {getAgent} from '#/state/session' export function useLikeMutation() { - const {agent} = useSession() - return useMutation({ mutationFn: async ({uri, cid}: {uri: string; cid: string}) => { - const res = await agent.like(uri, cid) + const res = await getAgent().like(uri, cid) return {uri: res.uri} }, }) } export function useUnlikeMutation() { - const {agent} = useSession() - return useMutation({ mutationFn: async ({uri}: {uri: string}) => { - await agent.deleteLike(uri) + await getAgent().deleteLike(uri) }, }) } |