API Table Forum Posting & API Table Forum Report Komentar

This commit is contained in:
2025-02-10 17:15:01 +08:00
25 changed files with 412 additions and 357 deletions

View File

@@ -38,6 +38,7 @@ const apiGetAdminCountForumReportPosting = async () => {
},
})
return await response.json().catch(() => null);
}
@@ -61,7 +62,7 @@ const apiGetAdminForumReportPosting = async () => {
const { token } = await fetch("/api/get-cookie").then((res) => res.json());
if (!token) return await token.json().catch(() => null);
const response = await fetch(`/api/admin/forum/dashboard/report_posting`, {
const response = await fetch(`/api/admin/forum/posting`, {
method: "GET",
headers: {
"Content-Type": "application/json",
@@ -73,11 +74,12 @@ const apiGetAdminForumReportPosting = async () => {
return await response.json().catch(() => null);
}
const apiGetAdminForumReportKomentar = async () => {
const apiGetAdminForumReportKomentar = async({ page } : { page?: string}) => {
const { token } = await fetch("/api/get-cookie").then((res) => res.json());
if (!token) return await token.json().catch(() => null);
const response = await fetch(`/api/admin/forum/dashboard/report_komentar`, {
const isPage = page ? `?page=${page}` : "";
const response = await fetch(`/api/admin/forum/komentar${isPage}`, {
method: "GET",
headers: {
"Content-Type": "application/json",
@@ -89,11 +91,12 @@ const apiGetAdminForumReportKomentar = async () => {
return await response.json().catch(() => null);
}
const apiGetAdminForumPublish = async () => {
const apiGetAdminForumPublish = async ({ page }: { page?: string }) => {
const { token } = await fetch("/api/get-cookie").then((res) => res.json());
if (!token) return await token.json().catch(() => null);
const response = await fetch(`/api/admin/forum/dashboard/publish`, {
const isPage = page ? `?page=${page}` : "";
const response = await fetch(`/api/admin/forum/publish${isPage}`, {
method: "GET",
headers: {
"Content-Type": "application/json",
@@ -102,6 +105,7 @@ const apiGetAdminForumPublish = async () => {
Authorization: `Bearer ${token}`,
},
})
return await response.json().catch(() => null);
}