1404/11/08-store style
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
import useAxios from "@/utils/useAxios";
|
||||
import type {PInventory, Product} from "@/models/products";
|
||||
import type {PWallet, Wallet} from '@/models/wallet'
|
||||
import type {Order} from "@/models/order";
|
||||
import {useUserStore} from "@/store/userStore";
|
||||
|
||||
const userStore = useUserStore()
|
||||
|
||||
export const checkoutCart = async (orders: Order[]): Promise<any> => {
|
||||
return await useAxios.post<Order[]>(`/customer/cart/checkout`, orders)
|
||||
}
|
||||
@@ -11,6 +11,7 @@ export const createOrder = async (obj: Order): Promise<any> => {
|
||||
return await useAxios.post<Order>(`/customer${!userStore.isSingle ? '' : '/single'}/order`, obj)
|
||||
}
|
||||
|
||||
|
||||
export const getOrders = async (tbl: Ref<UnwrapRef<TableInput>>): Promise<TableOutput<Transaction>> => {
|
||||
return await useAxios.post<TableOutput<Order>>(`/customer${!userStore.isSingle ? '' : '/single'}/order/table`, tbl)
|
||||
}
|
||||
|
||||
@@ -6,6 +6,9 @@ import type { PWallet, Wallet } from '@/models/wallet'
|
||||
export const getProducts = async (): Promise<any> => {
|
||||
return await useAxios.get<Product[]>(`/customer/product/list`)
|
||||
}
|
||||
export const getProductById = async ( id:number|null): Promise<any> => {
|
||||
return await useAxios.get<Product[]>(`/customer/product/list/${id}`)
|
||||
}
|
||||
export const getProductInventory = async (): Promise<any> => {
|
||||
return await useAxios.post<PInventory[]>(`/customer/wallet/product/table`)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user