blob: b7d707e6db5254aad5248cbe1a8647a0b950ddba (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
import axios from 'axios'
import preferredBrandApi from '../api/preferredBrandApi'
import { useQuery } from 'react-query'
const usePreferredBrand = () => {
const fetchPreferredBrand = async () => await preferredBrandApi()
const { data, isLoading } = useQuery('preferredBrand', fetchPreferredBrand)
return {
preferredBrands: { data, isLoading }
}
}
const GetBrands = (query) => {
const fetchingbrand = async () =>
await axios(`${process.env.NEXT_PUBLIC_SELF_HOST}/api/shop/brands?params=` + query)
const { data, isLoading } = useQuery('preferredBrand', fetchingbrand)
return {
preferredBrands: { data, isLoading }
}
}
export default GetBrands
|