From ebddfb20c5eff5d183923e3ca534e4aab43da790 Mon Sep 17 00:00:00 2001 From: richard-loafle <44828666+richard-loafle@users.noreply.github.com> Date: Fri, 7 Feb 2020 13:33:30 +0900 Subject: [PATCH] bug fixed --- .../src/app/AppWindow.ts | 30 ++++++++++++++++--- .../src/app/app-routing.module.ts | 10 +++---- 2 files changed, 31 insertions(+), 9 deletions(-) diff --git a/electron-projects/ucap-webmessenger-electron/src/app/AppWindow.ts b/electron-projects/ucap-webmessenger-electron/src/app/AppWindow.ts index 84964c7b..e905272b 100644 --- a/electron-projects/ucap-webmessenger-electron/src/app/AppWindow.ts +++ b/electron-projects/ucap-webmessenger-electron/src/app/AppWindow.ts @@ -5,6 +5,8 @@ import { app, BrowserWindow, screen, ipcMain, IpcMainEvent } from 'electron'; import windowStateKeeper from 'electron-window-state'; import { EventEmitter } from 'events'; +import log from 'electron-log'; + import { registerWindowStateChangedEvents } from '../lib/window-state'; import { ElectronAppChannel, @@ -164,10 +166,30 @@ export class AppWindow { } ); - this.window.webContents.on(ElectronWebContentsChannel.DidFailLoad, () => { - this.window.webContents.openDevTools(); - this.window.show(); - }); + this.window.webContents.on( + ElectronWebContentsChannel.DidFailLoad, + ( + event: Event, + errorCode: number, + errorDescription: string, + validatedURL: string, + isMainFrame: boolean + ) => { + if ('ERR_FILE_NOT_FOUND' === errorDescription) { + this.load(); + return; + } + log.error( + ElectronWebContentsChannel.DidFailLoad, + event, + errorCode, + errorDescription, + validatedURL, + isMainFrame + ); + this.window.webContents.openDevTools(); + } + ); registerWindowStateChangedEvents(this.window); diff --git a/projects/ucap-webmessenger-app/src/app/app-routing.module.ts b/projects/ucap-webmessenger-app/src/app/app-routing.module.ts index 99fef86b..e27fc322 100644 --- a/projects/ucap-webmessenger-app/src/app/app-routing.module.ts +++ b/projects/ucap-webmessenger-app/src/app/app-routing.module.ts @@ -10,26 +10,26 @@ const routes: Routes = [ import('./pages/messenger/messenger.page.module').then( m => m.AppMessengerPageModule ), - canActivate: [AppAuthGuard], + canActivate: [AppAuthGuard] }, { path: 'account', loadChildren: () => import('./pages/account/account.page.module').then( m => m.AppAccountPageModule - ), + ) }, { path: 'template', loadChildren: () => import('./pages/template/template.page.module').then( m => m.AppTemplatePageModule - ), - }, + ) + } ]; @NgModule({ imports: [RouterModule.forRoot(routes, { enableTracing: false })], - exports: [RouterModule], + exports: [RouterModule] }) export class AppRoutingModule {}