Merge pull request #261 from bipproduction/bagas/31-jan-25

fix event admin
This commit is contained in:
Bagasbanuna02
2025-01-31 17:54:47 +08:00
committed by GitHub
12 changed files with 1131 additions and 707 deletions

View File

@@ -1,11 +1,12 @@
export {
apiGetEventStatusCountDashboard,
apiGetEventTipeAcara,
apiGetEventRiwayatCount,
apiGetDataEventByStatus,
apiGetAdminEventStatusCountDashboard as apiGetEventStatusCountDashboard,
apiGetAdminEventCountTipeAcara as apiGetEventTipeAcara,
apiGetAdminEventRiwayatCount as apiGetEventRiwayatCount,
apiGetAdminEventByStatus as apiGetDataEventByStatus,
apiGetAdminEventRiwayat,
};
const apiGetEventStatusCountDashboard = async ({
const apiGetAdminEventStatusCountDashboard = async ({
name,
}: {
name: "Publish" | "Review" | "Reject";
@@ -26,7 +27,7 @@ const apiGetEventStatusCountDashboard = async ({
return await response.json().catch(() => null);
};
const apiGetEventRiwayatCount = async () => {
const apiGetAdminEventRiwayatCount = async () => {
const { token } = await fetch("/api/get-cookie").then((res) => res.json());
if (!token) return await token.json().catch(() => null);
@@ -43,7 +44,7 @@ const apiGetEventRiwayatCount = async () => {
return await response.json().catch(() => null);
};
const apiGetEventTipeAcara = async () => {
const apiGetAdminEventCountTipeAcara = async () => {
const { token } = await fetch("/api/get-cookie").then((res) => res.json());
if (!token) return await token.json().catch(() => null);
@@ -60,7 +61,7 @@ const apiGetEventTipeAcara = async () => {
return await response.json().catch(() => null);
};
const apiGetDataEventByStatus = async ({
const apiGetAdminEventByStatus = async ({
status,
page,
search,
@@ -74,7 +75,35 @@ const apiGetDataEventByStatus = async ({
const isPage = page ? `?page=${page}` : "";
const isSearch = search ? `&search=${search}` : "";
const respone = await fetch(`/api/admin/event/${status}${isPage}${isSearch}`, {
const respone = await fetch(
`/api/admin/event/${status}${isPage}${isSearch}`,
{
headers: {
"Content-Type": "application/json",
Accept: "application/json",
"Access-Control-Allow-Origin": "*",
Authorization: `Bearer ${token}`,
},
}
);
return await respone.json().catch(() => null);
};
const apiGetAdminEventRiwayat = async ({
page,
search,
}: {
page: string;
search: string;
}) => {
const { token } = await fetch("/api/get-cookie").then((res) => res.json());
if (!token) return await token.json().catch(() => null);
const isPage = page ? `?page=${page}` : "";
const isSearch = search ? `&search=${search}` : "";
const response = await fetch(`/api/admin/event/riwayat${isPage}${isSearch}`, {
method: "GET",
headers: {
"Content-Type": "application/json",
Accept: "application/json",
@@ -83,5 +112,5 @@ const apiGetDataEventByStatus = async ({
},
});
return await respone.json().catch(() => null);
return await response.json().catch(() => null);
};

View File

@@ -2,11 +2,11 @@ import { AdminEvent_Riwayat } from "@/app_modules/admin/event";
import { adminEvent_funGetListAllRiwayat } from "@/app_modules/admin/event/fun/get/get_list_all_riwayat";
export default async function Page() {
const listRiwayat = await adminEvent_funGetListAllRiwayat({ page: 1 });
// const listRiwayat = await adminEvent_funGetListAllRiwayat({ page: 1 });
return (
<>
<AdminEvent_Riwayat listRiwayat={listRiwayat} />
<AdminEvent_Riwayat />
</>
);
}

View File

@@ -1,5 +1,4 @@
import { AdminEvent_TablePublish } from "@/app_modules/admin/event";
import { adminEvent_funGetListPublish } from "@/app_modules/admin/event/fun";
async function Page() {
return (

View File

@@ -2,11 +2,10 @@ import { AdminEvent_TableReject } from "@/app_modules/admin/event";
import { adminEvent_funGetListReject } from "@/app_modules/admin/event/fun";
export default async function Page() {
const listReject = await adminEvent_funGetListReject({ page: 1 });
return (
<>
<AdminEvent_TableReject listReject={listReject as any} />
<AdminEvent_TableReject />
</>
);
}

View File

@@ -1,12 +1,10 @@
import { AdminEvent_TableReview } from "@/app_modules/admin/event";
import { adminEvent_funGetListReview } from "@/app_modules/admin/event/fun";
export default async function Page() {
const listReview = await adminEvent_funGetListReview({ page: 1 });
return (
<>
<AdminEvent_TableReview listData={listReview as any} />
<AdminEvent_TableReview />
</>
);
}