Filter out cancelled events from map display
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user