mirror of https://git.lenooby09.tech/LeNooby09/social-app.git
1import {useMutation} from '@tanstack/react-query'
2
3import {getAgent} from '#/state/session'
4
5export function useLikeMutation() {
6 return useMutation({
7 mutationFn: async ({uri, cid}: {uri: string; cid: string}) => {
8 const res = await getAgent().like(uri, cid)
9 return {uri: res.uri}
10 },
11 })
12}
13
14export function useUnlikeMutation() {
15 return useMutation({
16 mutationFn: async ({uri}: {uri: string}) => {
17 await getAgent().deleteLike(uri)
18 },
19 })
20}