From 721b1e6d5e8b9530f76b4346f2179601f3d1b6b5 Mon Sep 17 00:00:00 2001 From: Iris Olfermann Date: Mon, 2 Sep 2024 14:31:01 +0200 Subject: [PATCH] fixed modal that shows participants for an event --- src/Mealz/MealBundle/Resources/config/routing.yml | 2 +- src/Resources/src/api/getEventParticipants.ts | 5 +++-- src/Resources/src/components/dashboard/EventData.vue | 3 ++- .../src/components/eventParticipation/EventPopup.vue | 4 +++- src/Resources/src/stores/eventsStore.ts | 7 ++++--- 5 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/Mealz/MealBundle/Resources/config/routing.yml b/src/Mealz/MealBundle/Resources/config/routing.yml index 158f96bb7..6229ae1f3 100644 --- a/src/Mealz/MealBundle/Resources/config/routing.yml +++ b/src/Mealz/MealBundle/Resources/config/routing.yml @@ -357,7 +357,7 @@ MealzMealBundle_api_participations: methods: [ GET ] MealzMealBundle_api_event_participations: - path: /api/participations/event/{date} + path: /api/events/participation/{date}/{eventId} defaults: { _controller: App\Mealz\MealBundle\Controller\EventController::getEventParticipants } methods: [ GET ] diff --git a/src/Resources/src/api/getEventParticipants.ts b/src/Resources/src/api/getEventParticipants.ts index 78340f6e8..619351ee6 100644 --- a/src/Resources/src/api/getEventParticipants.ts +++ b/src/Resources/src/api/getEventParticipants.ts @@ -1,10 +1,11 @@ import useApi from './api'; import { type IMessage } from '@/interfaces/IMessage'; -export default async function getEventParticipants(date: string, eventId: number) { +export default async function getEventParticipants(date: string, participationId: number) { + console.log('getEventParticipants '+ participationId); const { error, response, request } = useApi( 'GET', - `api/participations/event/${date}/${eventId}` + `api/events/participation/${date}/${participationId}` ); await request(); diff --git a/src/Resources/src/components/dashboard/EventData.vue b/src/Resources/src/components/dashboard/EventData.vue index b47f8b308..dd6274077 100644 --- a/src/Resources/src/components/dashboard/EventData.vue +++ b/src/Resources/src/components/dashboard/EventData.vue @@ -41,6 +41,7 @@ /> (), { eventTitle: '' @@ -77,7 +78,8 @@ const isLoading = ref(false); watch(showParticipations, async () => { if (showParticipations.value === true) { isLoading.value = true; - participations.value = ((await getParticipantsForEvent(props.date, props.eventTitle)) as string[]).sort(); + participations.value = ((await getParticipantsForEvent(props.date, props.participationId)) as string[]).sort(); + console.log(participations.value); isLoading.value = false; } }); diff --git a/src/Resources/src/stores/eventsStore.ts b/src/Resources/src/stores/eventsStore.ts index caa0dc110..22cfa7eb6 100644 --- a/src/Resources/src/stores/eventsStore.ts +++ b/src/Resources/src/stores/eventsStore.ts @@ -217,9 +217,10 @@ export function useEvents() { } } - async function getParticipantsForEvent(date: string, eventSlug: string) { - const { error, response } = await getEventParticipants(date, getEventIdBySlug(eventSlug)); - + async function getParticipantsForEvent(date: string, participationId: number) { + console.log('ParticipationId: '+participationId); + const { error, response } = await getEventParticipants(date, participationId); + participationId if (error.value === true && isMessage(response.value) === true) { EventsState.error = (response.value as IMessage)?.message; } else if (error.value === true) {