upd: divisi

Deskripsi:
- info divisi

No Issues
This commit is contained in:
amel
2024-08-12 14:09:44 +08:00
parent 655df62dc6
commit 3bf3eed9aa
16 changed files with 400 additions and 146 deletions

View File

@@ -1,4 +1,4 @@
import { IFormFixDivision } from "./type_division";
import { IFormFixDivision, IFormMemberDivision } from "./type_division";
export const funGetAllDivision = async (path?: string) => {
const response = await fetch(`/api/division${(path) ? path : ''}`, { next: { tags: ['division'] } });
@@ -24,4 +24,27 @@ export const funCreateDivision = async (data: IFormFixDivision) => {
body: JSON.stringify(data),
});
return await response.json().catch(() => null);
}
}
export const funDeleteMemberDivision = async (path: string, data: { id: string }) => {
const response = await fetch(`/api/division/${path}/detail`, {
method: "DELETE",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify(data),
});
return await response.json().catch(() => null);
}
export const funEditStatusAdminDivision = async (path: string, data: { id: string, isAdmin: boolean }) => {
const response = await fetch(`/api/division/${path}/detail`, {
method: "PUT",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify(data),
});
return await response.json().catch(() => null);
};