import axios from "@/config/axios"; import type { AddTicketType, CreateFinalOrderType, OrderDetailResponseType, OrderItemResponseType, OrderResponseType, TicketsResponseType, } from "../types/Types"; import type { FieldResponseType, ProductResponeType, } from "@/pages/product/types/Types"; export const getOrders = async () => { const { data } = await axios.get(`/admin/orders`); return data; }; export const getOrderDetail = async (id: string) => { const { data } = await axios.get( `/admin/orders/${id}` ); return data; }; export const getTickets = async (orderId: string) => { const { data } = await axios.get( `/admin/ticket/order/${orderId}` ); return data; }; export const addTicket = async (ticketId: string, params: AddTicketType) => { const { data } = await axios.post( `/admin/ticket/order/item/${ticketId}`, params ); return data; }; export const submitOrder = async (params: CreateFinalOrderType) => { const { data } = await axios.post(`/admin/orders`, params); return data; }; export const updateOrder = async ( orderId: string, params: CreateFinalOrderType ) => { const { data } = await axios.patch(`/admin/orders/${orderId}`, params); return data; }; export const getProducts = async () => { const { data } = await axios.get(`/admin/products`); return data; }; export const getAttributes = async (productId?: number) => { const { data } = await axios.get( `/admin/entity/${productId}/field` ); return data; }; export const getOrderItem = async (itemId?: number) => { const { data } = await axios.get( `/admin/orders/item/${itemId}` ); return data; };