api ulandi
This commit is contained in:
36
src/features/specification/lib/api.ts
Normal file
36
src/features/specification/lib/api.ts
Normal file
@@ -0,0 +1,36 @@
|
||||
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;
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user