diff options
Diffstat (limited to 'src/lib/checkout/api')
| -rw-r--r-- | src/lib/checkout/api/checkoutApi.js | 9 | ||||
| -rw-r--r-- | src/lib/checkout/api/getVoucher.js | 8 |
2 files changed, 11 insertions, 6 deletions
diff --git a/src/lib/checkout/api/checkoutApi.js b/src/lib/checkout/api/checkoutApi.js index 94de8721..0d0cc918 100644 --- a/src/lib/checkout/api/checkoutApi.js +++ b/src/lib/checkout/api/checkoutApi.js @@ -11,9 +11,14 @@ export const checkoutApi = async ({ data }) => { return dataCheckout } -export const getProductsCheckout = async () => { +export const getProductsCheckout = async (voucher) => { const id = getAuth()?.id - const products = await odooApi('GET',`/api/v1/user/${id}/sale_order/checkout`) + 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 index 03ac3d6d..57d8acf5 100644 --- a/src/lib/checkout/api/getVoucher.js +++ b/src/lib/checkout/api/getVoucher.js @@ -1,11 +1,11 @@ import odooApi from '@/core/api/odooApi' -export const getVoucher = async () => { - const dataVoucher = await odooApi('GET', `/api/v1/voucher`) +export const getVoucher = async (id) => { + const dataVoucher = await odooApi('GET', `/api/v1/user/${id}/voucher`) return dataVoucher } -export const findVoucher = async (code) => { - const dataVoucher = await odooApi('GET', `/api/v1/voucher?code=${code}`) +export const findVoucher = async (code, id) => { + const dataVoucher = await odooApi('GET', `/api/v1/user/${id}/voucher?code=${code}`) return dataVoucher } |
