blob: 187d8fb8243658bd6f5a7b9725e6d521e368bc38 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
import {useMutation} from '@tanstack/react-query'
import {useSession} 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)
return {uri: res.uri}
},
})
}
export function useUnlikeMutation() {
const {agent} = useSession()
return useMutation({
mutationFn: async ({uri}: {uri: string}) => {
await agent.deleteLike(uri)
},
})
}
|