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 () => {
try {
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();
setEvents(data);
// Filter out cancelled events
const activeEvents = data.filter(event => event.status !== 'cancelled');
setEvents(activeEvents);
} catch (error) {
console.error('Failed to fetch events:', error);
// Fall back to sample data on error
setEvents(sampleEvents);
// Fall back to sample data on error (also filter cancelled)
setEvents(sampleEvents.filter(event => event.status !== 'cancelled'));
} finally {
setIsLoadingEvents(false);
}