diff --git a/pages/api/applications.ts b/pages/api/applications.ts index 5abf141..297c02d 100644 --- a/pages/api/applications.ts +++ b/pages/api/applications.ts @@ -40,8 +40,13 @@ export default async function handler( const applicationResponses = await ApplicationResponse.find({ userId: session.user.id, }).populate('eventId'); + + // get all the events that the user has applied to + const events = applicationResponses.map((response) => { + return response.eventId; + }); - return res.status(200).json({ message: applicationResponses }); + return res.status(200).json({ message: events }); } catch (error) { console.error(error); res.status(500).json({ message: error.message });