Fix: Intergrasi tampilan ke API

Package.json
Fix: Pem baharuan SDK53 -> SDK54

### No Issue
This commit is contained in:
2025-09-12 15:57:30 +08:00
parent 005b798688
commit 1d2153b253
9 changed files with 593 additions and 18350 deletions

View File

@@ -1,17 +1,58 @@
/* eslint-disable react-hooks/exhaustive-deps */
import {
AvatarUsernameAndOtherComponent,
BadgeCustom,
BaseBox,
ViewWrapper,
LoaderCustom,
TextCustom,
ViewWrapper
} from "@/components";
import { apiEventListOfParticipants } from "@/service/api-client/api-event";
import { useLocalSearchParams } from "expo-router";
import { useEffect, useState } from "react";
export default function EventListOfParticipants() {
const { id } = useLocalSearchParams();
const [listData, setListData] = useState([]);
const [isLoadData, setIsLoadData] = useState(false);
useEffect(() => {
onLoadData();
}, [id]);
const onLoadData = async () => {
try {
setIsLoadData(true);
const response = await apiEventListOfParticipants({ id: id as string });
if (response.success) {
console.log("Response", JSON.stringify(response.data, null, 2));
setListData(response.data);
}
} catch (error) {
console.log("[ERROR]", error);
} finally {
setIsLoadData(false);
}
};
return (
<ViewWrapper>
{Array.from({ length: 10 }).map((_, index) => (
<BaseBox key={index} paddingBlock={0}>
<AvatarUsernameAndOtherComponent avatarHref={`/profile/${index}`} />
</BaseBox>
))}
{isLoadData ? (
<LoaderCustom />
) : listData.length === 0 ? (
<TextCustom align="center">Belum ada peserta</TextCustom>
) : (
listData.map((item: any, index: number) => (
<BaseBox key={index}>
<AvatarUsernameAndOtherComponent
avatar={item?.User?.Profile?.imageId}
name={item?.User?.username}
avatarHref={`/profile/${item?.User?.Profile?.id}`}
rightComponent={<BadgeCustom color={item?.isPresent ? "green" : "red"}>{item?.isPresent ? "Hadir" : "Tidak Hadir"}</BadgeCustom>}
/>
</BaseBox>
))
)}
</ViewWrapper>
);
}