Filter out cancelled events from map display

This commit is contained in:
2025-11-18 19:18:54 +00:00
parent ab06cc8afd
commit a10e6329fe

View File

@@ -77,13 +77,15 @@ export function MapPage() {
const fetchEvents = async () => { const fetchEvents = async () => {
try { try {
setIsLoadingEvents(true); setIsLoadingEvents(true);
// Fetch upcoming and completed events to show on map // Fetch upcoming and completed events to show on map (exclude cancelled)
const data = await eventService.getEvents(); const data = await eventService.getEvents();
setEvents(data); // Filter out cancelled events
const activeEvents = data.filter(event => event.status !== 'cancelled');
setEvents(activeEvents);
} catch (error) { } catch (error) {
console.error('Failed to fetch events:', error); console.error('Failed to fetch events:', error);
// Fall back to sample data on error // Fall back to sample data on error (also filter cancelled)
setEvents(sampleEvents); setEvents(sampleEvents.filter(event => event.status !== 'cancelled'));
} finally { } finally {
setIsLoadingEvents(false); setIsLoadingEvents(false);
} }