From 559873d0dbbd01f78761cbebc779f1d278946952 Mon Sep 17 00:00:00 2001 From: richard-loafle <44828666+richard-loafle@users.noreply.github.com> Date: Tue, 11 Feb 2020 16:35:37 +0900 Subject: [PATCH] bug of reload app is fixed --- .../ucap-webmessenger-electron/src/app/AppWindow.ts | 8 +++++--- .../ucap-webmessenger-app/src/app/app-routing.module.ts | 4 +++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/electron-projects/ucap-webmessenger-electron/src/app/AppWindow.ts b/electron-projects/ucap-webmessenger-electron/src/app/AppWindow.ts index e905272b..4e8ec321 100644 --- a/electron-projects/ucap-webmessenger-electron/src/app/AppWindow.ts +++ b/electron-projects/ucap-webmessenger-electron/src/app/AppWindow.ts @@ -140,7 +140,7 @@ export class AppWindow { } } - public load(): void { + public load(hashUrl?: string): void { let startLoad = 0; this.window.webContents.once( @@ -176,7 +176,7 @@ export class AppWindow { isMainFrame: boolean ) => { if ('ERR_FILE_NOT_FOUND' === errorDescription) { - this.load(); + this.load(url.parse(validatedURL).hash); return; } log.error( @@ -187,6 +187,7 @@ export class AppWindow { validatedURL, isMainFrame ); + this.window.webContents.openDevTools(); } ); @@ -204,7 +205,8 @@ export class AppWindow { 'ucap-webmessenger-app/index.html' ), protocol: 'file:', - slashes: true + slashes: true, + hash: hashUrl }) ); } 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 e27fc322..22bd626b 100644 --- a/projects/ucap-webmessenger-app/src/app/app-routing.module.ts +++ b/projects/ucap-webmessenger-app/src/app/app-routing.module.ts @@ -29,7 +29,9 @@ const routes: Routes = [ ]; @NgModule({ - imports: [RouterModule.forRoot(routes, { enableTracing: false })], + imports: [ + RouterModule.forRoot(routes, { useHash: true, enableTracing: false }) + ], exports: [RouterModule] }) export class AppRoutingModule {}