blob: 1eb17d53be3612fe1b1c6e57fac98b67c1bd48e8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
|
import { useQuery } from "react-query"
import wishlistApi from "../api/wishlistApi"
const useWishlist = ({ productId }) => {
const fetchWishlist = async () => await wishlistApi({ productId })
const { data, isLoading, refetch } = useQuery(`wishlist-${productId}`, fetchWishlist)
return {
wishlist: { data, isLoading, refetch }
}
}
export default useWishlist
|