upd: task

Deskripsi:
- tambah detail task divisi

No Issues
This commit is contained in:
amel
2024-08-19 15:15:16 +08:00
parent ca1d3433ef
commit 5e591c6908
8 changed files with 234 additions and 5 deletions

View File

@@ -1,4 +1,4 @@
import { IFormDateTask, IFormTaskDivision } from "./type_task";
import { IFormAddDetailTask, IFormDateTask, IFormTaskDivision } from "./type_task";
export const funGetAllTask = async (path?: string) => {
const response = await fetch(`/api/task${(path) ? path : ''}`, { next: { tags: ['task'] } });
@@ -64,4 +64,16 @@ export const funEditDetailTask = async (path: string, data: IFormDateTask) => {
body: JSON.stringify(data),
});
return await response.json().catch(() => null);
};
export const funCreateDetailTask = async (path: string, data: IFormAddDetailTask) => {
const response = await fetch(`/api/task/${path}`, {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify(data),
});
return await response.json().catch(() => null);
};