fitur: divisi

Deskripsi:
- pengaplikasian api terbaru pada divisi
- list divisi
- create divisi
- detail divisi

No Issues
This commit is contained in:
amel
2024-08-09 17:25:02 +08:00
parent 925e54deec
commit f0c708a8f3
32 changed files with 821 additions and 353 deletions

View File

@@ -0,0 +1,27 @@
import { IFormFixDivision } from "./type_division";
export const funGetAllDivision = async (path?: string) => {
const response = await fetch(`/api/division${(path) ? path : ''}`, { next: { tags: ['division'] } });
return await response.json().catch(() => null);
}
export const funGetDivisionById = async (path: string) => {
const response = await fetch(`/api/division/${path}`);
return await response.json().catch(() => null);
}
export const funGetDetailDivisionById = async (path: string, kategori: string) => {
const response = await fetch(`/api/division/${path}/detail?cat=${kategori}`);
return await response.json().catch(() => null);
}
export const funCreateDivision = async (data: IFormFixDivision) => {
const response = await fetch("/api/division", {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify(data),
});
return await response.json().catch(() => null);
}