From 7315ea8455b380b53451e8cdfb412e628f643427 Mon Sep 17 00:00:00 2001 From: akastijn Date: Sat, 8 Nov 2025 18:06:13 +0100 Subject: [PATCH] Navigate to root path after successful login via `login/:code` route in `AuthGuard`. --- frontend/src/app/guards/auth.guard.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/frontend/src/app/guards/auth.guard.ts b/frontend/src/app/guards/auth.guard.ts index 22b0c59..6b86631 100644 --- a/frontend/src/app/guards/auth.guard.ts +++ b/frontend/src/app/guards/auth.guard.ts @@ -27,6 +27,9 @@ export class AuthGuard implements CanActivate { return this.authService.login(code).pipe( switchMap(() => { 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); }), catchError(() => of(this.router.createUrlTree(['/'])))