Quick fixes to core libs (#2263)

This commit is contained in:
Omar López 2022-03-23 20:29:27 -07:00 committed by GitHub
parent 1a27edd462
commit f7a2e1e7ac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -11,7 +11,7 @@ export const getCalendar = (credential: Credential | null): Calendar | null => {
if (!credential) return null;
const { type: calendarType } = credential;
const calendarApp = appStore[calendarType.split("_").join("") as keyof typeof appStore];
if (!calendarApp || !("lib" in calendarApp && "CalendarService" in calendarApp.lib)) {
if (!(calendarApp && "lib" in calendarApp && "CalendarService" in calendarApp.lib)) {
log.warn(`calendar of type ${calendarType} does not implemented`);
return null;
}

View File

@ -18,7 +18,7 @@ const getVideoAdapters = (withCredentials: Credential[]): VideoApiAdapter[] =>
withCredentials.reduce<VideoApiAdapter[]>((acc, cred) => {
const appName = cred.type.split("_").join(""); // Transform `zoom_video` to `zoomvideo`;
const app = appStore[appName as keyof typeof appStore];
if ("lib" in app && "VideoApiAdapter" in app.lib) {
if (app && "lib" in app && "VideoApiAdapter" in app.lib) {
const makeVideoApiAdapter = app.lib.VideoApiAdapter as VideoApiAdapterFactory;
const videoAdapter = makeVideoApiAdapter(cred);
acc.push(videoAdapter);