doctor and pharmacies crud
This commit is contained in:
36
src/features/objects/lib/api.ts
Normal file
36
src/features/objects/lib/api.ts
Normal file
@@ -0,0 +1,36 @@
|
||||
import type {
|
||||
ObjectCreate,
|
||||
ObjectListRes,
|
||||
ObjectUpdate,
|
||||
} from "@/features/objects/lib/data";
|
||||
import httpClient from "@/shared/config/api/httpClient";
|
||||
import { OBJECT } from "@/shared/config/api/URLs";
|
||||
import type { AxiosResponse } from "axios";
|
||||
|
||||
export const object_api = {
|
||||
async list(params: {
|
||||
limit?: number;
|
||||
offset?: number;
|
||||
name?: string;
|
||||
district?: string;
|
||||
user?: string;
|
||||
}): Promise<AxiosResponse<ObjectListRes>> {
|
||||
const res = await httpClient.get(`${OBJECT}list/`, { params });
|
||||
return res;
|
||||
},
|
||||
|
||||
async create(body: ObjectCreate) {
|
||||
const res = await httpClient.post(`${OBJECT}create/`, body);
|
||||
return res;
|
||||
},
|
||||
|
||||
async update({ body, id }: { id: number; body: ObjectUpdate }) {
|
||||
const res = await httpClient.patch(`${OBJECT}${id}/update/`, body);
|
||||
return res;
|
||||
},
|
||||
|
||||
async delete(id: number) {
|
||||
const res = await httpClient.delete(`${OBJECT}${id}/delete/`);
|
||||
return res;
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user