aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src
diff options
context:
space:
mode:
Diffstat (limited to 'client/src')
-rw-r--r--client/src/app/app.component.ts14
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 @@
1import { Component, OnInit } from '@angular/core' 1import { Component, OnInit } from '@angular/core'
2import { DomSanitizer, SafeHtml } from '@angular/platform-browser' 2import { DomSanitizer, SafeHtml } from '@angular/platform-browser'
3import { GuardsCheckStart, Router } from '@angular/router' 3import { GuardsCheckStart, Router, NavigationEnd } from '@angular/router'
4import { AuthService, RedirectService, ServerService } from '@app/core' 4import { AuthService, RedirectService, ServerService } from '@app/core'
5import { isInSmallView } from '@app/shared/misc/utils' 5import { 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