update api request and response
This commit is contained in:
17
src/features/distributed/lib/api.ts
Normal file
17
src/features/distributed/lib/api.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import type { DistributedList } from "@/features/distributed/lib/data";
|
||||
import httpClient from "@/shared/config/api/httpClient";
|
||||
import { API_URLS } from "@/shared/config/api/URLs";
|
||||
import type { AxiosResponse } from "axios";
|
||||
|
||||
export const distributed_api = {
|
||||
async list(params: {
|
||||
limit?: number;
|
||||
offset?: number;
|
||||
product?: string;
|
||||
user?: string;
|
||||
date?: string;
|
||||
}): Promise<AxiosResponse<DistributedList>> {
|
||||
const res = await httpClient.get(API_URLS.DISTRIBUTED, { params });
|
||||
return res;
|
||||
},
|
||||
};
|
||||
29
src/features/distributed/lib/data.ts
Normal file
29
src/features/distributed/lib/data.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
export interface DistributedList {
|
||||
status_code: number;
|
||||
status: string;
|
||||
message: string;
|
||||
data: {
|
||||
count: number;
|
||||
next: null | string;
|
||||
previous: null | string;
|
||||
results: DistributedListData[];
|
||||
};
|
||||
}
|
||||
|
||||
export interface DistributedListData {
|
||||
id: number;
|
||||
product: {
|
||||
id: number;
|
||||
name: string;
|
||||
price: number;
|
||||
};
|
||||
quantity: number;
|
||||
employee_name: string;
|
||||
user: {
|
||||
id: number;
|
||||
first_name: string;
|
||||
last_name: string;
|
||||
};
|
||||
created_at: string;
|
||||
date: string;
|
||||
}
|
||||
Reference in New Issue
Block a user