aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/core
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-11-27 15:31:09 +0100
committerChocobozzz <me@florianbigard.com>2020-11-27 15:46:49 +0100
commit68f6c87a27bd3616644368154914a683001f8aa6 (patch)
treed1db9fb50f9973b697c43c5c06935a5c5a9ff819 /client/src/app/core
parentacfa2e300defbf79994f49b2062ec6bece5ad1a9 (diff)
downloadPeerTube-68f6c87a27bd3616644368154914a683001f8aa6.tar.gz
PeerTube-68f6c87a27bd3616644368154914a683001f8aa6.tar.zst
PeerTube-68f6c87a27bd3616644368154914a683001f8aa6.zip
Various front optimizations
Diffstat (limited to 'client/src/app/core')
-rw-r--r--client/src/app/core/routing/redirect.service.ts9
1 files changed, 9 insertions, 0 deletions
diff --git a/client/src/app/core/routing/redirect.service.ts b/client/src/app/core/routing/redirect.service.ts
index 3982cf36f..4f4b346e2 100644
--- a/client/src/app/core/routing/redirect.service.ts
+++ b/client/src/app/core/routing/redirect.service.ts
@@ -11,6 +11,8 @@ export class RedirectService {
11 private previousUrl: string 11 private previousUrl: string
12 private currentUrl: string 12 private currentUrl: string
13 13
14 private redirectingToHomepage = false
15
14 constructor ( 16 constructor (
15 private router: Router, 17 private router: Router,
16 private serverService: ServerService 18 private serverService: ServerService
@@ -56,10 +58,17 @@ export class RedirectService {
56 } 58 }
57 59
58 redirectToHomepage (skipLocationChange = false) { 60 redirectToHomepage (skipLocationChange = false) {
61 if (this.redirectingToHomepage) return
62
63 this.redirectingToHomepage = true
64
59 console.log('Redirecting to %s...', RedirectService.DEFAULT_ROUTE) 65 console.log('Redirecting to %s...', RedirectService.DEFAULT_ROUTE)
60 66
61 this.router.navigate([ RedirectService.DEFAULT_ROUTE ], { skipLocationChange }) 67 this.router.navigate([ RedirectService.DEFAULT_ROUTE ], { skipLocationChange })
68 .then(() => this.redirectingToHomepage = false)
62 .catch(() => { 69 .catch(() => {
70 this.redirectingToHomepage = false
71
63 console.error( 72 console.error(
64 'Cannot navigate to %s, resetting default route to %s.', 73 'Cannot navigate to %s, resetting default route to %s.',
65 RedirectService.DEFAULT_ROUTE, 74 RedirectService.DEFAULT_ROUTE,