RocketChat/Rocket.Chat

View on GitHub
apps/meteor/client/views/outlookCalendar/lib/syncOutlookEvents.ts

Summary

Maintainability
A
0 mins
Test Coverage
import { NotOnDesktopError } from './NotOnDesktopError';

export const syncOutlookEvents = async () => {
    const date = new Date();
    const desktopApp = window.RocketChatDesktop;

    if (!desktopApp?.getOutlookEvents) {
        throw new NotOnDesktopError();
    }

    const response = await desktopApp.getOutlookEvents(date);
    if (response.status === 'canceled') {
        throw new Error('abort');
    }
};