diff options
| author | HATEC\SPVDEV001 <tri.susilo@altama.co.id> | 2023-03-27 11:28:58 +0700 |
|---|---|---|
| committer | HATEC\SPVDEV001 <tri.susilo@altama.co.id> | 2023-03-27 11:28:58 +0700 |
| commit | e77ab00b04426f85d04d211f5ab4a511e754ed4f (patch) | |
| tree | 191721d87e780df07dabf06fb0136fa9d6de0b68 /src/lib/variant | |
| parent | 8876e48c35f41b77e61ba90bd95ab4c993d67e9e (diff) | |
| parent | bc04e721d51e149709ab3cfaf5e77ef034511860 (diff) | |
Merge branch 'master' of https://bitbucket.org/altafixco/next-indoteknik
Diffstat (limited to 'src/lib/variant')
| -rw-r--r-- | src/lib/variant/api/variantPriceApi.js | 8 | ||||
| -rw-r--r-- | src/lib/variant/hooks/useVariantPrice.js | 13 |
2 files changed, 21 insertions, 0 deletions
diff --git a/src/lib/variant/api/variantPriceApi.js b/src/lib/variant/api/variantPriceApi.js new file mode 100644 index 00000000..8621ca78 --- /dev/null +++ b/src/lib/variant/api/variantPriceApi.js @@ -0,0 +1,8 @@ +import odooApi from '@/core/api/odooApi' + +const variantPriceApi = async ({ id }) => { + const dataVariantPrice = await odooApi('GET', `/api/v1/product/product/price/${id}`) + return dataVariantPrice +} + +export default variantPriceApi diff --git a/src/lib/variant/hooks/useVariantPrice.js b/src/lib/variant/hooks/useVariantPrice.js new file mode 100644 index 00000000..d00eb810 --- /dev/null +++ b/src/lib/variant/hooks/useVariantPrice.js @@ -0,0 +1,13 @@ +import { useQuery } from 'react-query' +import variantPriceApi from '../api/variantPriceApi' + +const useVariantPrice = ({ id }) => { + const fetchVariantPrice = async () => await variantPriceApi({ id }) + const variantPrice = useQuery(`variantPrice-${id}`, fetchVariantPrice, { + refetchOnWindowFocus: false + }) + + return { variantPrice } +} + +export default useVariantPrice |
