/* eslint-disable react-hooks/exhaustive-deps */ import { AvatarUsernameAndOtherComponent, BadgeCustom, BaseBox, 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 ( {isLoadData ? ( ) : listData.length === 0 ? ( Belum ada peserta ) : ( listData.map((item: any, index: number) => ( {item?.isPresent ? "Hadir" : "Tidak Hadir"}} /> )) )} ); }