X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=client%2Fsrc%2Fapp%2Fcore%2Frouting%2Fredirect.service.ts;h=d4cb0436e54324b2b609805c5094ed857833966b;hb=cb28bb92daf1a0e123bc0144030c2bc65b865f4a;hp=198332b00bdd925363b576d541627549b9251e6a;hpb=2989628b7913383b39ac34c7db8666a21f8e5037;p=github%2FChocobozzz%2FPeerTube.git diff --git a/client/src/app/core/routing/redirect.service.ts b/client/src/app/core/routing/redirect.service.ts index 198332b00..d4cb0436e 100644 --- a/client/src/app/core/routing/redirect.service.ts +++ b/client/src/app/core/routing/redirect.service.ts @@ -42,22 +42,29 @@ export class RedirectService { return this.defaultRoute } - getDefaultTrendingAlgorithm () { return this.defaultTrendingAlgorithm } - redirectToPreviousRoute () { + 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.navigateByUrl(fallbackRoute) + } + return this.redirectToHomepage() }