diff options
| author | IT Fixcomart <it@fixcomart.co.id> | 2024-09-04 03:00:30 +0000 |
|---|---|---|
| committer | trisusilo <tri.susilo@altama.co.id> | 2024-09-04 03:00:30 +0000 |
| commit | 69c9ecc99c487c16129f5dcb66c4775453589220 (patch) | |
| tree | 7aead541e26b5166ae3d2049fc732c7030e4e9c6 /src/lib/promo/hooks/usePromotionSearch.js | |
| parent | 985f29aa1d9b8cbea49d25c30099f88c86bdc13f (diff) | |
| parent | f6a398c036d2ab833ecb798fa88e641e2f801bb0 (diff) | |
Merged in backup-release (pull request #289)
Backup release
Approved-by: trisusilo
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 |
