upd: task divisi
Deskripsi: - update task divisi - delete detail task - update status task - edit detail task No Issues
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { IFormTaskDivision } from "./type_task";
|
||||
import { IFormDateTask, IFormTaskDivision } from "./type_task";
|
||||
|
||||
export const funGetAllTask = async (path?: string) => {
|
||||
const response = await fetch(`/api/task${(path) ? path : ''}`, { next: { tags: ['task'] } });
|
||||
@@ -23,4 +23,45 @@ export const funCreateTask = async (data: IFormTaskDivision) => {
|
||||
export const funGetTaskDivisionById = async (path: string, kategori: string) => {
|
||||
const response = await fetch(`/api/task/${path}?cat=${kategori}`);
|
||||
return await response.json().catch(() => null);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
export const funDeleteDetailTask = async (path: string) => {
|
||||
const response = await fetch(`/api/task/detail/${path}`, {
|
||||
method: "DELETE",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
});
|
||||
return await response.json().catch(() => null);
|
||||
};
|
||||
|
||||
|
||||
export const funUpdateStatusDetailTask = async (path: string, data: { status: number }) => {
|
||||
const response = await fetch(`/api/task/detail/${path}`, {
|
||||
method: "PUT",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
body: JSON.stringify(data),
|
||||
});
|
||||
return await response.json().catch(() => null);
|
||||
};
|
||||
|
||||
|
||||
export const funGetDetailTask = async (path: string) => {
|
||||
const response = await fetch(`/api/task/detail/${path}`);
|
||||
return await response.json().catch(() => null);
|
||||
}
|
||||
|
||||
|
||||
export const funEditDetailTask = async (path: string, data: IFormDateTask) => {
|
||||
const response = await fetch(`/api/task/detail/${path}`, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
body: JSON.stringify(data),
|
||||
});
|
||||
return await response.json().catch(() => null);
|
||||
};
|
||||
@@ -1,4 +1,16 @@
|
||||
import { hookstate } from "@hookstate/core";
|
||||
import { IFormMemberTask } from "./type_task";
|
||||
|
||||
export const globalMemberTask = hookstate<IFormMemberTask[]>([]);
|
||||
export const globalMemberTask = hookstate<IFormMemberTask[]>([]);
|
||||
export const globalRefreshTask = hookstate<boolean>(false);
|
||||
|
||||
export const valStatusDetailTask = [
|
||||
{
|
||||
name: "Belum Dikerjakan",
|
||||
value: 0
|
||||
},
|
||||
{
|
||||
name: "Selesai",
|
||||
value: 1
|
||||
}
|
||||
]
|
||||
Reference in New Issue
Block a user