upd: tambah anggota task

Deskripsi:
-tambah anggota task

NO ISsues
This commit is contained in:
amel
2024-08-19 16:11:20 +08:00
parent 5e591c6908
commit 912f4fd309
10 changed files with 303 additions and 8 deletions

View File

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

View File

@@ -27,6 +27,12 @@ export interface IFormAddDetailTask {
}
export interface IFormAddMemberTask {
idDivision: string
member: IFormMemberTask[] | []
}
export interface IFormTaskDivision {
idDivision: string
title: string
@@ -51,6 +57,7 @@ export interface IDataListTaskDivision {
export interface IDataMemberTaskDivision {
id: string
idUser: string
name: string
email: string
}