upd: edit divisi
No Issues
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { IFormFixDivision, IFormMemberDivision } from "./type_division";
|
||||
import { IFormDivision, IFormFixDivision, IFormMemberDivision } from "./type_division";
|
||||
|
||||
export const funGetAllDivision = async (path?: string) => {
|
||||
const response = await fetch(`/api/division${(path) ? path : ''}`, { next: { tags: ['division'] } });
|
||||
@@ -26,6 +26,17 @@ export const funCreateDivision = async (data: IFormFixDivision) => {
|
||||
return await response.json().catch(() => null);
|
||||
}
|
||||
|
||||
export const funEditDivision = async (path: string, data: IFormDivision) => {
|
||||
const response = await fetch(`/api/division/${path}`, {
|
||||
method: "PUT",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
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",
|
||||
@@ -47,4 +58,16 @@ export const funEditStatusAdminDivision = async (path: string, data: { id: strin
|
||||
body: JSON.stringify(data),
|
||||
});
|
||||
return await response.json().catch(() => null);
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
export const funAddDivisionMember = async (path: string, data: IFormMemberDivision) => {
|
||||
const response = await fetch(`/api/division/${path}/detail`, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
body: JSON.stringify(data),
|
||||
});
|
||||
return await response.json().catch(() => null);
|
||||
}
|
||||
Reference in New Issue
Block a user