diff options
| author | HATEC\SPVDEV001 <tri.susilo@altama.co.id> | 2023-07-25 15:26:55 +0700 |
|---|---|---|
| committer | HATEC\SPVDEV001 <tri.susilo@altama.co.id> | 2023-07-25 15:26:55 +0700 |
| commit | 915443e3f3a7dcf567fbf5a1dff7c6d6647d11b5 (patch) | |
| tree | 08ff05daa8f8f3335abd9c12c28bb1affffda58d /src/lib/checkout/api | |
| parent | 33ccd445bf3e72eafeadc920de0f788af91e57fd (diff) | |
| parent | d4f3cce1b07c5d4f75892ffc49c8dbbbbb58922f (diff) | |
Merge branch 'master' into Feature/SLA
# Conflicts:
# src/lib/product/components/Product/ProductDesktop.jsx
# src/lib/product/components/Product/ProductMobile.jsx
Diffstat (limited to 'src/lib/checkout/api')
| -rw-r--r-- | src/lib/checkout/api/checkoutApi.js | 14 | ||||
| -rw-r--r-- | src/lib/checkout/api/getVoucher.js | 11 |
2 files changed, 23 insertions, 2 deletions
diff --git a/src/lib/checkout/api/checkoutApi.js b/src/lib/checkout/api/checkoutApi.js index b76c9b7f..0d0cc918 100644 --- a/src/lib/checkout/api/checkoutApi.js +++ b/src/lib/checkout/api/checkoutApi.js @@ -1,7 +1,7 @@ import odooApi from '@/core/api/odooApi' import { getAuth } from '@/core/utils/auth' -const checkoutApi = async ({ data }) => { +export const checkoutApi = async ({ data }) => { const auth = getAuth() const dataCheckout = await odooApi( 'POST', @@ -11,4 +11,14 @@ const checkoutApi = async ({ data }) => { return dataCheckout } -export default checkoutApi +export const getProductsCheckout = async (voucher) => { + const id = getAuth()?.id + let products + if(voucher){ + products = await odooApi('GET',`/api/v1/user/${id}/sale_order/checkout?voucher=${voucher}`) + }else{ + products = await odooApi('GET',`/api/v1/user/${id}/sale_order/checkout`) + } + + return products +} diff --git a/src/lib/checkout/api/getVoucher.js b/src/lib/checkout/api/getVoucher.js new file mode 100644 index 00000000..57d8acf5 --- /dev/null +++ b/src/lib/checkout/api/getVoucher.js @@ -0,0 +1,11 @@ +import odooApi from '@/core/api/odooApi' + +export const getVoucher = async (id) => { + const dataVoucher = await odooApi('GET', `/api/v1/user/${id}/voucher`) + return dataVoucher +} + +export const findVoucher = async (code, id) => { + const dataVoucher = await odooApi('GET', `/api/v1/user/${id}/voucher?code=${code}`) + return dataVoucher +} |
