Files
gg-backend/frontend/src/api/department.ts

50 lines
1.0 KiB
TypeScript
Raw Normal View History

2026-03-16 17:55:33 +05:30
import apiClient from "@/api/client";
export interface Department {
departmentId: string;
name: string;
para1: string;
para2: string;
para3: string;
facilities: string;
services: string;
}
export const getDepartmentsApi = async () => {
const res = await apiClient.get("/departments/getAll");
return res.data;
};
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;
};
export const updateDepartmentApi = async (
2026-03-17 13:11:00 +05:30
departmentId: string,
2026-03-16 17:55:33 +05:30
data: {
name?: string;
para1?: string;
para2?: string;
para3?: string;
facilities?: string;
services?: string;
},
) => {
2026-03-17 13:11:00 +05:30
const res = await apiClient.put(`/departments/${departmentId}`, data);
2026-03-16 17:55:33 +05:30
return res.data;
};
2026-03-17 13:11:00 +05:30
export const deleteDepartmentApi = async (departmentId: string) => {
const res = await apiClient.delete(`/departments/${departmentId}`);
2026-03-16 17:55:33 +05:30
return res.data;
};