feat : update add calender

This commit is contained in:
lukman
2024-08-16 14:26:57 +08:00
parent 9b0450c75e
commit 4b94f47d5e
8 changed files with 451 additions and 28 deletions

View File

@@ -1,10 +1,29 @@
import { IFormCreateCalender } from "./type_calender";
export const funGetAllCalender = async (path?: string) => {
const response = await fetch(`/api/calender${(path) ? path : ''}`, { next: { tags: ['calender'] } });
return await response.json().catch(() => null);
}
export const funGetOneCalender = async (path: string) => {
const response = await fetch(`/api/calender/${path}`);
return await response.json().catch(() => null);
}
export const funCreateCalender = async (data: IFormCreateCalender) => {
const response = await fetch("/api/calender", {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify(data),
});
return await response.json().catch(() => null);
}
export const funDeleteCalenderById = async (path: string) => {
const response = await fetch(`/api/calender/${path}`, {
method: "DELETE",
});
return await response.json().catch(() => null);
}