summaryrefslogtreecommitdiff
path: root/src/lib/home/hooks/useCategoryHome.js
blob: ea9f8d6a28b97e7a74107c79ab0e9713a1657353 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import categoryHomeApi from '../api/categoryHomeApi'
import { useQuery } from 'react-query'

const useCategoryHome = ({ id }) => {
  const fetchCategoryHome = async () => await categoryHomeApi({ id })
  const { isLoading, data } = useQuery(`categoryHome-${id}`, fetchCategoryHome, {
    refetchOnWindowFocus: false
  })

  return {
    categoryHome: { data, isLoading }
  }
}

export default useCategoryHome