aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/app.component.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-05-23 10:58:50 +0200
committerChocobozzz <me@florianbigard.com>2018-05-23 10:58:50 +0200
commitb851dabf78d0a7ffad64913498c1f9cd37f16268 (patch)
tree324990f15853562746ece84d3b31f6496035ef9b /client/src/app/app.component.ts
parent45c0fb35eb3904cbea91ff1ee450d308bbb4ebdb (diff)
downloadPeerTube-b851dabf78d0a7ffad64913498c1f9cd37f16268.tar.gz
PeerTube-b851dabf78d0a7ffad64913498c1f9cd37f16268.tar.zst
PeerTube-b851dabf78d0a7ffad64913498c1f9cd37f16268.zip
Always redirect on homepage on '/'
Diffstat (limited to 'client/src/app/app.component.ts')
-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