fitur: divisi
Deskripsi: - pengaplikasian api terbaru pada divisi - list divisi - create divisi - detail divisi No Issues
This commit is contained in:
27
src/module/division_new/lib/api_division.ts
Normal file
27
src/module/division_new/lib/api_division.ts
Normal 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);
|
||||
}
|
||||
Reference in New Issue
Block a user