fix event

deskripsi:
- fix riwayat event
This commit is contained in:
2025-02-21 11:40:15 +08:00
parent e0143c5d8c
commit bb5ca3a0ea
12 changed files with 359 additions and 142 deletions

View File

@@ -1,4 +1,4 @@
export { apiGetEventByStatus, apiGetKontribusiEvent };
export { apiGetEventByStatus, apiGetKontribusiEvent, apiGetRiwayatEvent };
const apiGetEventByStatus = async ({
status,
@@ -81,3 +81,47 @@ const apiGetKontribusiEvent = async ({ page }: { page: string }) => {
throw error; // Re-throw the error to handle it in the calling function
}
};
const apiGetRiwayatEvent = async ({
name,
page,
}: {
name: string;
page: string;
}) => {
try {
// Fetch token from cookie
const { token } = await fetch("/api/get-cookie").then((res) => res.json());
if (!token) {
console.error("No token found");
return null;
}
// Send PUT request to update portfolio logo
const isPage = `?page=${page}`;
const response = await fetch(`/api/event/riwayat/${name}${isPage}`, {
method: "GET",
headers: {
"Content-Type": "application/json",
Accept: "application/json",
Authorization: `Bearer ${token}`,
},
});
// Check if the response is OK
if (!response.ok) {
const errorData = await response.json().catch(() => null);
console.error(
"Error updating portfolio logo:",
errorData?.message || "Unknown error"
);
return null;
}
return await response.json();
} catch (error) {
console.error("Error updating portfolio medsos:", error);
throw error; // Re-throw the error to handle it in the calling function
}
};

View File

@@ -19,13 +19,6 @@ export function ComponentEvent_CardRiwayat({ data }: { data: MODEL_EVENT }) {
<>
<ComponentGlobal_CardStyles marginBottom={"15px"}>
<Stack>
{/* <ComponentGlobal_AuthorNameOnHeader
profileId={data.Author?.Profile?.id}
imagesId={data.Author?.Profile?.imagesId}
authorName={data.Author?.Profile?.name}
isPembatas={true}
/> */}
<ComponentGlobal_AvatarAndUsername
profile={data.Author?.Profile as any}
/>
@@ -45,7 +38,7 @@ export function ComponentEvent_CardRiwayat({ data }: { data: MODEL_EVENT }) {
<Text align="right" fz={"sm"} lineClamp={1}>
{new Intl.DateTimeFormat("id-ID", {
dateStyle: "medium",
}).format(data.tanggal)}
}).format(new Date(data.tanggal))}
</Text>
</Group>

View File

@@ -1,4 +1,3 @@
import { RouterEvent } from "@/lib/router_hipmi/router_event";
import { AccentColor, MainColor } from "@/app_modules/_global/color";
import { ComponentGlobal_NotifikasiPeringatan } from "@/app_modules/_global/notif_global";
import { ActionIcon, Flex, Loader, Paper, Text } from "@mantine/core";

View File

@@ -0,0 +1,12 @@
export const listTabsRiwayatEvent = [
{
id: "1",
label: "Semua Riwayat",
value: "semua",
},
{
id: "2",
label: "Riwayat Saya",
value: "saya",
},
];