summaryrefslogtreecommitdiff
path: root/src/lib/promo/hooks
diff options
context:
space:
mode:
authorit-fixcomart <it@fixcomart.co.id>2024-09-04 09:54:44 +0700
committerit-fixcomart <it@fixcomart.co.id>2024-09-04 09:54:44 +0700
commitf6a398c036d2ab833ecb798fa88e641e2f801bb0 (patch)
tree7aead541e26b5166ae3d2049fc732c7030e4e9c6 /src/lib/promo/hooks
parentcbdeecd2fb8770afe46a374292e6ed3e5ec48214 (diff)
parentad168bf46919b46f708625b7d2fdc56606ec9af6 (diff)
Merge branch 'update-allPromo-fetch' into backup-release
Diffstat (limited to 'src/lib/promo/hooks')
-rw-r--r--src/lib/promo/hooks/usePromotionSearch.js15
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