feat: add department dashboard
This commit is contained in:
57
frontend/src/api/department.ts
Normal file
57
frontend/src/api/department.ts
Normal file
@@ -0,0 +1,57 @@
|
||||
import apiClient from "@/api/client";
|
||||
|
||||
export interface Department {
|
||||
departmentId: string;
|
||||
name: string;
|
||||
para1: string;
|
||||
para2: string;
|
||||
para3: string;
|
||||
facilities: string;
|
||||
services: string;
|
||||
}
|
||||
|
||||
/* ---------------- GET ALL ---------------- */
|
||||
|
||||
export const getDepartmentsApi = async () => {
|
||||
const res = await apiClient.get("/departments/getAll");
|
||||
return res.data;
|
||||
};
|
||||
|
||||
/* ---------------- CREATE ---------------- */
|
||||
|
||||
export const createDepartmentApi = async (data: {
|
||||
departmentId: string;
|
||||
name: string;
|
||||
para1?: string;
|
||||
para2?: string;
|
||||
para3?: string;
|
||||
facilities?: string;
|
||||
services?: string;
|
||||
}) => {
|
||||
const res = await apiClient.post("/departments", data);
|
||||
return res.data;
|
||||
};
|
||||
|
||||
/* ---------------- UPDATE ---------------- */
|
||||
|
||||
export const updateDepartmentApi = async (
|
||||
id: number,
|
||||
data: {
|
||||
name?: string;
|
||||
para1?: string;
|
||||
para2?: string;
|
||||
para3?: string;
|
||||
facilities?: string;
|
||||
services?: string;
|
||||
},
|
||||
) => {
|
||||
const res = await apiClient.put(`/departments/${id}`, data);
|
||||
return res.data;
|
||||
};
|
||||
|
||||
/* ---------------- DELETE ---------------- */
|
||||
|
||||
export const deleteDepartmentApi = async (id: number) => {
|
||||
const res = await apiClient.delete(`/departments/${id}`);
|
||||
return res.data;
|
||||
};
|
||||
Reference in New Issue
Block a user