Skip to content

Commit

Permalink
Added fetch in /eventid/participants
Browse files Browse the repository at this point in the history
  • Loading branch information
subru-37 committed Oct 8, 2024
1 parent 0e1b9d6 commit 346468d
Showing 1 changed file with 14 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,20 @@ export default function Participants() {
const { orgId, eventId } = router.query;
const { loading, get } = useFetch();

const fetchParticipants = async () => {
const { data, status } = await get(
`/core/organizations/${orgId}/events/${eventId}/participants`,
);
if (status === 200) {
setParticipants(data.participants || []);
} else {
showAlert({ title: 'Error', description: data.error, status: 'error' });
}
};

useEffect(() => {
const fetchParticipants = async () => {
const { data, status } = await get(
`/core/organizations/${orgId}/events/${eventId}/participants`,
);
if (status === 200) {
setParticipants(data.participants || []);
} else {
showAlert({ title: 'Error', description: data.error, status: 'error' });
}
};
fetchParticipants();
}, [orgId, eventId]);

const handleInputChange = (e) => {
const { name, value } = e.target;
Expand Down

0 comments on commit 346468d

Please sign in to comment.