ensure mergedCalendars array exists
This commit is contained in:
parent
69a6718af8
commit
7dfa5875fe
|
@ -126,10 +126,17 @@ function saveCalendarData(calendarId, linkGroupName, calendars) {
|
||||||
console.error('Error reading calendars file:', error);
|
console.error('Error reading calendars file:', error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Ensure mergedCalendars array exists
|
||||||
|
if (!calendarsData.mergedCalendars) {
|
||||||
|
calendarsData.mergedCalendars = [];
|
||||||
|
}
|
||||||
|
|
||||||
calendarsData.mergedCalendars.push({
|
calendarsData.mergedCalendars.push({
|
||||||
id: calendarId,
|
id: calendarId,
|
||||||
|
linkGroupName: linkGroupName,
|
||||||
calendars: calendars
|
calendars: calendars
|
||||||
});
|
});
|
||||||
|
|
||||||
fs.writeFileSync(CALENDARS_FILE, JSON.stringify(calendarsData, null, 2));
|
fs.writeFileSync(CALENDARS_FILE, JSON.stringify(calendarsData, null, 2));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue