Bug fix in extractEventFromNote with minimum Note

This commit is contained in:
ssmucny 2023-04-24 22:35:32 -04:00
parent a4c726498b
commit bcbc261e3b
1 changed files with 13 additions and 9 deletions

View File

@ -41,15 +41,19 @@ export class ApEventService {
throw new Error('invalid type');
}
const title = note.name!;
const start = note.startTime!;
const end = note.endTime ?? null;
if (note.name && note.startTime) {
const title = note.name;
const start = note.startTime;
const end = note.endTime ?? null;
return {
title,
start,
end,
metadata: {},
};
return {
title,
start,
end,
metadata: {},
};
} else {
throw new Error('Invalid event properties')
}
}
}