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