summaryrefslogtreecommitdiff
path: root/src/lib/checkout/api/getVoucher.js
blob: 15c6abbb5606017e0600a658fb60d20090c384e1 (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
29
30
31
import odooApi from '@/core/api/odooApi'
import { getAuth } from '@/core/utils/auth'

export  const getVoucher = async (id, source) => {
  let dataVoucher = null
  if(source){
    dataVoucher = await odooApi('GET', `/api/v1/user/${id}/voucher?source=${source}`)
  }else {
    dataVoucher = await odooApi('GET', `/api/v1/user/${id}/voucher`)
  }
  return dataVoucher
}

export const findVoucher = async (code, id, source) => {
  let dataVoucher = null
  if(source){
    dataVoucher = await odooApi('GET', `/api/v1/user/${id}/voucher?code=${code}&source=${source}`)
  }else{
    dataVoucher = await odooApi('GET', `/api/v1/user/${id}/voucher?code=${code}`)
  }
  return dataVoucher
}


export const getVoucherNew = async (source) => {
  const id = getAuth()?.id;
  const dataVoucher = await odooApi('GET', `/api/v1/user/${id}/voucher?${source}`)

  return dataVoucher

}