37 lines
1.0 KiB
TypeScript
37 lines
1.0 KiB
TypeScript
import type {
|
|
FactoryListRes,
|
|
OrderCreateReq,
|
|
OrderList,
|
|
ProductListRes,
|
|
} from "@/features/specification/lib/data";
|
|
import httpClient from "@/shared/config/api/httpClient";
|
|
import { FACTORY, ORDER, PRODUCT } from "@/shared/config/api/URLs";
|
|
import type { AxiosResponse } from "axios";
|
|
|
|
export const order_api = {
|
|
async factory_list(): Promise<AxiosResponse<FactoryListRes>> {
|
|
const res = await httpClient.get(FACTORY);
|
|
return res;
|
|
},
|
|
|
|
async product_list(): Promise<AxiosResponse<ProductListRes>> {
|
|
const res = await httpClient.get(PRODUCT);
|
|
return res;
|
|
},
|
|
|
|
async order_list(): Promise<AxiosResponse<OrderList>> {
|
|
const res = await httpClient.get(`${ORDER}list/`);
|
|
return res;
|
|
},
|
|
|
|
async order_create(body: OrderCreateReq) {
|
|
const res = await httpClient.post(`${ORDER}create/`, body);
|
|
return res;
|
|
},
|
|
|
|
async update({ body, id }: { id: number; body: { paid_price: number } }) {
|
|
const res = await httpClient.patch(`${ORDER}${id}/update/`, body);
|
|
return res;
|
|
},
|
|
};
|