refactor: move authInfo check to initializeWorkspaceView

This commit is contained in:
tiddlygit-test 2021-07-24 19:10:49 +08:00
parent 42ae2a61de
commit 3a0e96f9eb
2 changed files with 13 additions and 13 deletions

View file

@ -59,6 +59,19 @@ export class WorkspaceView implements IWorkspaceViewService {
if (mainWindow === undefined) {
throw new Error(i18n.t(`Error.MainWindowMissing`));
}
if (workspace.storageService !== SupportedStorageServices.local) {
const userInfo = this.authService.getStorageServiceUserInfo(workspace.storageService);
if (userInfo === undefined) {
// user not login into Github or something else
void dialog.showMessageBox(mainWindow, {
title: i18n.t('Dialog.StorageServiceUserInfoNoFound'),
message: i18n.t('Dialog.StorageServiceUserInfoNoFoundDetail'),
buttons: ['OK'],
cancelId: 0,
defaultId: 0,
});
}
}
await this.wikiService.wikiStartup(workspace);
const userInfo = await this.authService.getStorageServiceUserInfo(workspace.storageService);