diff options
author | Chocobozzz <me@florianbigard.com> | 2018-05-23 10:58:50 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-05-23 10:58:50 +0200 |
commit | b851dabf78d0a7ffad64913498c1f9cd37f16268 (patch) | |
tree | 324990f15853562746ece84d3b31f6496035ef9b | |
parent | 45c0fb35eb3904cbea91ff1ee450d308bbb4ebdb (diff) | |
download | PeerTube-b851dabf78d0a7ffad64913498c1f9cd37f16268.tar.gz PeerTube-b851dabf78d0a7ffad64913498c1f9cd37f16268.tar.zst PeerTube-b851dabf78d0a7ffad64913498c1f9cd37f16268.zip |
Always redirect on homepage on '/'
-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 | ||