Initial commit from monorepo
This commit is contained in:
57
app/composables/useOrdersRestAPI.js
Normal file
57
app/composables/useOrdersRestAPI.js
Normal file
@@ -0,0 +1,57 @@
|
||||
export const useOrdersRestAPI = () => {
|
||||
const config = useRuntimeConfig()
|
||||
|
||||
const getTeamOrders = async (teamUuid) => {
|
||||
try {
|
||||
const response = await $fetch(`${config.public.odooApiUrl}/fastapi/orders/api/v1/orders/team/${teamUuid}`, {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
}
|
||||
})
|
||||
|
||||
return response
|
||||
} catch (error) {
|
||||
console.error('Error fetching team orders:', error)
|
||||
throw error
|
||||
}
|
||||
}
|
||||
|
||||
const getOrderByUuid = async (orderUuid) => {
|
||||
try {
|
||||
const response = await $fetch(`${config.public.odooApiUrl}/fastapi/orders/api/v1/orders/${orderUuid}`, {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
}
|
||||
})
|
||||
|
||||
return response
|
||||
} catch (error) {
|
||||
console.error('Error fetching order:', error)
|
||||
throw error
|
||||
}
|
||||
}
|
||||
|
||||
const getCompanies = async () => {
|
||||
try {
|
||||
const response = await $fetch(`${config.public.odooApiUrl}/fastapi/companies/api/v1/companies`, {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
}
|
||||
})
|
||||
|
||||
return response
|
||||
} catch (error) {
|
||||
console.error('Error fetching companies:', error)
|
||||
throw error
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
getTeamOrders,
|
||||
getOrderByUuid,
|
||||
getCompanies
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user