api ulandi

This commit is contained in:
Samandar Turgunboyev
2025-11-27 19:58:21 +05:00
parent bd23d3f2ad
commit 0c647ff5ff
33 changed files with 928 additions and 418 deletions

View 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;
},
};