diff options
| author | it-fixcomart <it@fixcomart.co.id> | 2024-09-02 16:43:25 +0700 |
|---|---|---|
| committer | it-fixcomart <it@fixcomart.co.id> | 2024-09-02 16:43:25 +0700 |
| commit | b30e6a53d660f9ccbc0ded640c2a1dc5df673ff2 (patch) | |
| tree | ae840e06b29d9ccdeb88c31b17d1962ebd9f5539 /src/lib/promo/hooks | |
| parent | 3f384749fe51a2763e7e99351f36ce70954afb7a (diff) | |
<iman> update fetch data
Diffstat (limited to 'src/lib/promo/hooks')
| -rw-r--r-- | src/lib/promo/hooks/usePromotionSearch.js | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/lib/promo/hooks/usePromotionSearch.js b/src/lib/promo/hooks/usePromotionSearch.js new file mode 100644 index 00000000..1a194646 --- /dev/null +++ b/src/lib/promo/hooks/usePromotionSearch.js @@ -0,0 +1,15 @@ +import { useQuery } from 'react-query' +import productSearchApi from '../api/productSearchApi' +import _ from 'lodash-contrib' + +const usePromotionSearch = ({ query, operation }) => { + const queryString = _.toQuery(query) + const fetchProductSearch = async () => await productSearchApi({ query: queryString , operation : operation}) + const productSearch = useQuery(`promoSearch-${queryString}`, fetchProductSearch) + + return { + productSearch + } +} + +export default usePromotionSearch |
