summaryrefslogtreecommitdiff
path: root/src/lib/checkout/api/checkoutApi.js
blob: 0d0cc918452230ace065f788115cba8f0cf26530 (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
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) => {
  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
}