summaryrefslogtreecommitdiff
path: root/src/lib/brand/hooks/useBrand.js
blob: be42a44cbc68ff3ae8a1423170355291fcece369 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
import { useQuery } from "react-query"
import BrandApi from "../api/BrandApi"

const useBrand = ({ id }) => {
  const fetchBrand = async () => await BrandApi({ id })
  const { data, isLoading } = useQuery(`brand-${id}`, fetchBrand)

  return {
    brand: { data, isLoading }
  }
}

export default useBrand