diff options
-rw-r--r-- | client/src/app/app.component.ts | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/client/src/app/app.component.ts b/client/src/app/app.component.ts index d5ba24e23..0bd127063 100644 --- a/client/src/app/app.component.ts +++ b/client/src/app/app.component.ts | |||
@@ -1,6 +1,6 @@ | |||
1 | import { Component, OnInit } from '@angular/core' | 1 | import { Component, OnInit } from '@angular/core' |
2 | import { DomSanitizer, SafeHtml } from '@angular/platform-browser' | 2 | import { DomSanitizer, SafeHtml } from '@angular/platform-browser' |
3 | import { GuardsCheckStart, Router } from '@angular/router' | 3 | import { GuardsCheckStart, Router, NavigationEnd } from '@angular/router' |
4 | import { AuthService, RedirectService, ServerService } from '@app/core' | 4 | import { AuthService, RedirectService, ServerService } from '@app/core' |
5 | import { isInSmallView } from '@app/shared/misc/utils' | 5 | import { isInSmallView } from '@app/shared/misc/utils' |
6 | 6 | ||
@@ -50,10 +50,14 @@ export class AppComponent implements OnInit { | |||
50 | ngOnInit () { | 50 | ngOnInit () { |
51 | document.getElementById('incompatible-browser').className += ' browser-ok' | 51 | document.getElementById('incompatible-browser').className += ' browser-ok' |
52 | 52 | ||
53 | const pathname = window.location.pathname | 53 | this.router.events.subscribe(e => { |
54 | if (!pathname || pathname === '/') { | 54 | if (e instanceof NavigationEnd) { |
55 | this.redirectService.redirectToHomepage() | 55 | const pathname = window.location.pathname |
56 | } | 56 | if (!pathname || pathname === '/') { |
57 | this.redirectService.redirectToHomepage() | ||
58 | } | ||
59 | } | ||
60 | }) | ||
57 | 61 | ||
58 | this.authService.loadClientCredentials() | 62 | this.authService.loadClientCredentials() |
59 | 63 | ||