change submit order

This commit is contained in:
hamid zarghami
2026-01-31 09:29:58 +03:30
parent 10245bdb08
commit 8dbfcdad53
5 changed files with 29 additions and 11 deletions
+12 -4
View File
@@ -1,6 +1,7 @@
import axios from "@/config/axios";
import type {
AddTicketType,
AttributeResponseType,
MyOrdersResponseType,
OrderDetailResponseType,
OrderType,
@@ -14,6 +15,13 @@ export const getProducts = async () => {
return data;
};
export const getAttributes = async (productId?: number) => {
const { data } = await axios.get<AttributeResponseType>(
`/public/entity/${productId}/field`
);
return data;
};
export const submitOrder = async (params: OrderType[]) => {
const { data } = await axios.post(`/public/orders`, { items: params });
return data;
@@ -21,7 +29,7 @@ export const submitOrder = async (params: OrderType[]) => {
export const getMyOrders = async (
page: number = 1,
active: TabMyOrdersEnum,
active: TabMyOrdersEnum
) => {
const statuses =
active === TabMyOrdersEnum.IN_PROGRESS
@@ -47,21 +55,21 @@ export const getMyOrders = async (
query += `&statuses=${statuses}`;
}
const { data } = await axios.get<MyOrdersResponseType>(
`/public/orders${query}`,
`/public/orders${query}`
);
return data;
};
export const getOrderDetails = async (id: string) => {
const { data } = await axios.get<OrderDetailResponseType>(
`/public/orders/${id}`,
`/public/orders/${id}`
);
return data;
};
export const getTickets = async (orderId: string) => {
const { data } = await axios.get<TicketsResponseType>(
`/public/ticket/order/${orderId}`,
`/public/ticket/order/${orderId}`
);
return data;
};