blob: 24f1868acf56988656b8406403499f14da1fb21e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
import odooApi from '@/core/api/odooApi'
import { getAuth } from '@/core/utils/auth'
export const checkoutApi = async ({ data }) => {
const auth = getAuth()
const dataCheckout = await odooApi(
'POST',
`/api/v1/partner/${auth.partnerId}/sale_order/checkout`,
data
)
return dataCheckout
}
export const getProductsCheckout = async (voucher, query) => {
const id = getAuth()?.id
let products
if(voucher && query){
products = await odooApi('GET',`/api/v1/user/${id}/sale_order/checkout?voucher=${voucher}&source=buy`)
}else if (voucher){
products = await odooApi('GET',`/api/v1/user/${id}/sale_order/checkout?voucher=${voucher}`)
}else if (query) {
products = await odooApi('GET',`/api/v1/user/${id}/sale_order/checkout?source=buy`)
}else{
products = await odooApi('GET',`/api/v1/user/${id}/sale_order/checkout`)
}
return products
}
|