Navigate to root path after successful login via login/:code route in AuthGuard.
This commit is contained in:
parent
b7c553acc1
commit
7315ea8455
|
|
@ -27,6 +27,9 @@ export class AuthGuard implements CanActivate {
|
||||||
return this.authService.login(code).pipe(
|
return this.authService.login(code).pipe(
|
||||||
switchMap(() => {
|
switchMap(() => {
|
||||||
const result = this.canActivateInternal(route, state);
|
const result = this.canActivateInternal(route, state);
|
||||||
|
if (route.routeConfig?.path === 'login/:code') {
|
||||||
|
this.router.navigateByUrl('/', {replaceUrl: true}).then();
|
||||||
|
}
|
||||||
return isObservable(result) ? result : result instanceof Promise ? from(result) : of(result);
|
return isObservable(result) ? result : result instanceof Promise ? from(result) : of(result);
|
||||||
}),
|
}),
|
||||||
catchError(() => of(this.router.createUrlTree(['/'])))
|
catchError(() => of(this.router.createUrlTree(['/'])))
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user