rev: diskusi umum
Deskripsi: - memberi komentar - edit diskusi - hapus diskusi - status aktif diskusi - tambah anggota diskusi - hapus anggota diskusi No Issues
This commit is contained in:
@@ -20,3 +20,72 @@ export const funGetOneDiscussionGeneral = async (id: string, path: string) => {
|
||||
const response = await fetch(`/api/discussion-general/${id}${(path) ? path : ''}`, { next: { tags: ['discussion-general'] } });
|
||||
return await response.json().catch(() => null);
|
||||
}
|
||||
|
||||
export const funCreateComentDiscussionGeneral = async (path: string, data: { desc: string }) => {
|
||||
const response = await fetch(`/api/discussion-general/${path}/comment`, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
body: JSON.stringify(data),
|
||||
});
|
||||
return await response.json().catch(() => null);
|
||||
}
|
||||
|
||||
|
||||
|
||||
export const funEditStatusDiscussionGeneral = async (path: string, data: { status: number }) => {
|
||||
const response = await fetch(`/api/discussion-general/${path}`, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
body: JSON.stringify(data),
|
||||
});
|
||||
return await response.json().catch(() => null);
|
||||
}
|
||||
|
||||
|
||||
export const funEditDiscussionGeneral = async (path: string, data: { title: string, desc: string }) => {
|
||||
const response = await fetch(`/api/discussion-general/${path}`, {
|
||||
method: "PUT",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
body: JSON.stringify(data),
|
||||
});
|
||||
return await response.json().catch(() => null);
|
||||
}
|
||||
|
||||
|
||||
export const funDeleteDiscussionGeneral = async (path: string) => {
|
||||
const response = await fetch(`/api/discussion-general/${path}`, {
|
||||
method: "DELETE",
|
||||
});
|
||||
return await response.json().catch(() => null);
|
||||
}
|
||||
|
||||
export const funAddMemberDiscussionGeneral = async (path: string, data: { member: IFormMemberDisscussionGeneral[] }) => {
|
||||
const response = await fetch(`/api/discussion-general/${path}/member`, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
body: JSON.stringify(data)
|
||||
})
|
||||
|
||||
return await response.json().catch(() => null)
|
||||
}
|
||||
|
||||
|
||||
export const funDelMemberDiscussionGeneral = async (path: string, data: { idUser: string }) => {
|
||||
const response = await fetch(`/api/discussion-general/${path}/member`, {
|
||||
method: "DELETE",
|
||||
headers: {
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
body: JSON.stringify(data)
|
||||
})
|
||||
|
||||
return await response.json().catch(() => null)
|
||||
}
|
||||
Reference in New Issue
Block a user