fix(calendar): use r.Route subrouter to avoid chi path ambiguity with /channels/events/{eventID}
This commit is contained in:
@@ -49,7 +49,11 @@ export function CalendarView({ channelId, channelName }: CalendarViewProps) {
|
||||
const to = `${date.getFullYear()}-${String(date.getMonth() + 2).padStart(2, '0')}-01T00:00:00Z`;
|
||||
setLoading(true);
|
||||
api.get<CalendarEvent[]>(`/channels/${channelId}/events?from=${encodeURIComponent(from)}&to=${encodeURIComponent(to)}`)
|
||||
.then((data) => setEvents(Array.isArray(data) ? data : []))
|
||||
.then((data) => {
|
||||
console.log('[calendar] loaded', data?.length, 'events for channel', channelId);
|
||||
setEvents(Array.isArray(data) ? data : []);
|
||||
})
|
||||
.catch((err) => console.error('[calendar] fetch error:', err))
|
||||
.finally(() => setLoading(false));
|
||||
}, [channelId, date]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user