refactor(electron): create electron api package (#5334)

This commit is contained in:
EYHN
2023-12-27 06:38:37 +00:00
parent ce17daba42
commit 4e861d8118
53 changed files with 307 additions and 690 deletions
@@ -1,3 +1,5 @@
import { apis } from '@affine/electron-api';
import { assertExists } from '@blocksuite/global/utils';
import { useCallback } from 'react';
import { redirect } from 'react-router-dom';
@@ -23,7 +25,8 @@ export const Component = () => {
const openApp = useCallback(() => {
if (environment.isDesktop) {
window.apis.ui.handleOpenMainApp().catch(err => {
assertExists(apis);
apis.ui.handleOpenMainApp().catch(err => {
console.log('failed to open main app', err);
});
} else {