From 3da46c203bd5dd7af3423ae4c052a8f6b5dd6d79 Mon Sep 17 00:00:00 2001 From: akastijn Date: Sun, 12 Oct 2025 21:34:59 +0200 Subject: [PATCH] Add navigation to current URL after login dialog completion --- frontend/src/app/services/auth.service.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/frontend/src/app/services/auth.service.ts b/frontend/src/app/services/auth.service.ts index 3c6e0d5..e61a826 100644 --- a/frontend/src/app/services/auth.service.ts +++ b/frontend/src/app/services/auth.service.ts @@ -7,6 +7,7 @@ import {JwtHelperService} from '@auth0/angular-jwt'; import {JwtClaims} from '@custom-types/jwt_interface' import {LoginDialogComponent} from '@shared-components/login/login.component'; import {MatDialog} from '@angular/material/dialog'; +import {Router} from '@angular/router'; @Injectable({ providedIn: 'root' @@ -24,7 +25,8 @@ export class AuthService { constructor( private loginService: LoginService, - private snackBar: MatSnackBar + private snackBar: MatSnackBar, + private router: Router ) { // Check if user is already logged in on service initialization this.checkAuthStatus(); @@ -76,11 +78,14 @@ export class AuthService { const jwt = this.getJwt(); if (!jwt) { console.log("No JWT found"); + const currentUrl = this.router.url; const dialogRef = this.dialog.open(LoginDialogComponent, { width: '400px', }) dialogRef.afterClosed().subscribe(result => { - console.log(result); + if (result) { + this.router.navigateByUrl(currentUrl).then(); + } }); return false; }