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