Properly parse list calendar call to MS Graph (#3698)
This commit is contained in:
parent
2aee450c0b
commit
37309e8435
|
@ -158,8 +158,12 @@ export default class Office365CalendarService implements Calendar {
|
|||
|
||||
async listCalendars(): Promise<IntegrationCalendar[]> {
|
||||
const response = await this.fetcher(`/me/calendars`);
|
||||
const responseBody = (await handleErrorsJson(response)) as { value: OfficeCalendar[] };
|
||||
return responseBody.value.map((cal) => {
|
||||
let responseBody = await handleErrorsJson(response);
|
||||
// If responseBody is valid then parse the JSON text
|
||||
if (typeof responseBody === "string") {
|
||||
responseBody = JSON.parse(responseBody) as { value: OfficeCalendar[] };
|
||||
}
|
||||
return responseBody.value.map((cal: OfficeCalendar) => {
|
||||
const calendar: IntegrationCalendar = {
|
||||
externalId: cal.id ?? "No Id",
|
||||
integration: this.integrationName,
|
||||
|
|
Loading…
Reference in New Issue
Block a user