Skip to content

Commit 99242ca

Browse files
author
Bernardo-MG
committed
Corrected return route assignation
1 parent c106688 commit 99242ca

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

src/app/core/authentication/guard/logged-in.guard.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { inject } from '@angular/core';
2-
import { Router } from '@angular/router';
2+
import { ActivatedRoute, Router } from '@angular/router';
33
import { SecurityContainer } from '../services/security-container.service';
44

55
/**
@@ -19,7 +19,9 @@ export const LoggedInGuard = () => {
1919
} else {
2020
// Not logged in
2121
// Redirect to login
22-
router.navigate([loginRoute], { queryParams: { returnUrl: router.routerState.snapshot.url } });
22+
if (router.routerState.snapshot.url.split('?')[0] !== loginRoute) {
23+
router.navigate([loginRoute], { queryParams: { returnUrl: router.routerState.snapshot.url } });
24+
}
2325
active = false;
2426
}
2527

0 commit comments

Comments
 (0)