Skip to content
Snippets Groups Projects
use-user-likes.ts 416 B
import { useQuery } from "@tanstack/react-query"

import { ILike } from "@/components/gweets/types"

import { getUserLikes } from "../api/get-user-likes"

export const useUserLikes = (id: string | undefined) => {
    return useQuery<ILike[]>(
        ["likes", { userId: id }],
        async () => {
            return getUserLikes(id)
        },
        {
            refetchOnWindowFocus: false,
        },
    )
}