]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/app/core/routing/redirect.service.ts
Add URL redirection support for external auth
[github/Chocobozzz/PeerTube.git] / client / src / app / core / routing / redirect.service.ts
index 571476d1de529583b793c08ca5a2f8b3cd1fb65d..d4cb0436e54324b2b609805c5094ed857833966b 100644 (file)
@@ -46,19 +46,23 @@ export class RedirectService {
     return this.defaultTrendingAlgorithm
   }
 
-  redirectToPreviousRoute (fallbackRoute: string[] = null) {
+  getPreviousUrl () {
+    return this.previousUrl
+  }
+
+  redirectToPreviousRoute (fallbackRoute?: string) {
     const exceptions = [
       '/verify-account',
       '/reset-password'
     ]
 
-    if (this.previousUrl) {
+    if (this.previousUrl && this.previousUrl !== '/') {
       const isException = exceptions.find(e => this.previousUrl.startsWith(e))
       if (!isException) return this.router.navigateByUrl(this.previousUrl)
     }
 
     if (fallbackRoute) {
-      return this.router.navigate(fallbackRoute)
+      return this.router.navigateByUrl(fallbackRoute)
     }
 
     return this.redirectToHomepage()