Support ical calendars
This commit is contained in:
parent
950d690020
commit
4dc2343917
1 changed files with 4 additions and 1 deletions
|
@ -1,4 +1,5 @@
|
|||
import STATIC_LOCATIONS from './static-ens-locations.json'
|
||||
import ICAL from 'ical.js'
|
||||
|
||||
// https://stackoverflow.com/a/35970186
|
||||
function invertColor(hex) {
|
||||
|
@ -208,7 +209,9 @@ function mkExportUrl(id, { cloud }) {
|
|||
|
||||
function fetchCalendar(id, cal, extra = {}) {
|
||||
return fetch(mkCalendarUrl(id, cal, extra), { credentials: 'omit' })
|
||||
.then(resp => resp.json())
|
||||
.then( cal.isICS
|
||||
? resp => resp.text().then(text => ICAL.parse(text))
|
||||
: resp => resp.json())
|
||||
.catch(err => console.error(err))
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue