]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/app/core/routing/redirect.service.ts
emit more specific status codes on video upload (#3423)
[github/Chocobozzz/PeerTube.git] / client / src / app / core / routing / redirect.service.ts
index 3982cf36f31a6e1eea1559f2bea65f541a599046..4f4b346e2f0f93b89a1740b53607f22d26f0cf7e 100644 (file)
@@ -11,6 +11,8 @@ export class RedirectService {
   private previousUrl: string
   private currentUrl: string
 
+  private redirectingToHomepage = false
+
   constructor (
     private router: Router,
     private serverService: ServerService
@@ -56,10 +58,17 @@ export class RedirectService {
   }
 
   redirectToHomepage (skipLocationChange = false) {
+    if (this.redirectingToHomepage) return
+
+    this.redirectingToHomepage = true
+
     console.log('Redirecting to %s...', RedirectService.DEFAULT_ROUTE)
 
     this.router.navigate([ RedirectService.DEFAULT_ROUTE ], { skipLocationChange })
+        .then(() => this.redirectingToHomepage = false)
         .catch(() => {
+          this.redirectingToHomepage = false
+
           console.error(
             'Cannot navigate to %s, resetting default route to %s.',
             RedirectService.DEFAULT_ROUTE,