summaryrefslogtreecommitdiff
path: root/src/lib/brand/hooks/useBrand.js
blob: 3ba65a97e219b53d18f96fa471deaadb36c8719c (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