diff options
| author | it-fixcomart <it@fixcomart.co.id> | 2024-09-20 16:52:16 +0700 |
|---|---|---|
| committer | it-fixcomart <it@fixcomart.co.id> | 2024-09-20 16:52:16 +0700 |
| commit | a784f4623448ff846dbc5c8259405e6cce8fffb7 (patch) | |
| tree | 016da331ea5a18ef2c3c1264728b1199b5e9172a /src/lib/promo/hooks/usePromotionSearch.js | |
| parent | 1db54e16f970b4e09df89d432efd5a66ac775eb6 (diff) | |
| parent | b7e7696d675d0c2e36364f7cbedb0483a343048d (diff) | |
Merge branch 'release' into Feature/new-register
Diffstat (limited to 'src/lib/promo/hooks/usePromotionSearch.js')
| -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 |
