diff --git a/src/App.svelte b/src/App.svelte index 0b21292..fa67410 100644 --- a/src/App.svelte +++ b/src/App.svelte @@ -37,18 +37,30 @@ let selectedCalendars; - onMount(async () => { + async function reloadEvents(selectedCalendars, options) { const evts = await refreshEvents(selectedCalendars); - options.events = evts.flat(); + return evts.flat(); + } + + + onMount(async () => { + options.events = await reloadEvents(selectedCalendars, options); options = { ...options }; }); + + $: { + reloadEvents(selectedCalendars, options).then(events => { + options.events = events; + options = { ...options }; + }); + }

Calendrier de la vie étudiante à l'ENS

- +
diff --git a/src/calendar.js b/src/calendar.js index 7e17974..4a6570a 100644 --- a/src/calendar.js +++ b/src/calendar.js @@ -117,7 +117,7 @@ export function mkEvent(title, start, duration, ...rest) { export function refreshEvents(selectedCalendars) { return Promise.all( calendarIds - .filter(id => selectedCalendars ? selectedCalendars.includes(id) : true) + .filter(id => selectedCalendars ? selectedCalendars.includes(calendars[id].name) : true) .map(id => mkEventsFromCalendar(id, calendars[id])) ); }