From b43693df2f21a69b7e73535aab93d0aa27552cef Mon Sep 17 00:00:00 2001 From: Peter Maquiran Date: Fri, 3 Sep 2021 17:11:13 +0100 Subject: [PATCH] Fix guard loop --- src/app/guards/auth.guard.ts | 4 ++-- src/app/guards/login.guard.ts | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/app/guards/auth.guard.ts b/src/app/guards/auth.guard.ts index 83859aead..b493d2813 100644 --- a/src/app/guards/auth.guard.ts +++ b/src/app/guards/auth.guard.ts @@ -18,9 +18,9 @@ export class AuthGuard implements CanActivate { state: RouterStateSnapshot): Observable | Promise | boolean | UrlTree { if(!SessionStore.user.Inactivity) { - this.router.navigate(['/inactivity']); + this.router.navigate(['/']); } - else if(window.location.pathname != '' && !SessionStore.exist) { + else if(!SessionStore.exist) { this.router.navigate(['/']); return false } else { diff --git a/src/app/guards/login.guard.ts b/src/app/guards/login.guard.ts index 375d80d13..8b7a734d3 100644 --- a/src/app/guards/login.guard.ts +++ b/src/app/guards/login.guard.ts @@ -17,6 +17,7 @@ export class LoginGuard implements CanActivate { // console.log(SessionStore.exist, SessionStore.user.Inactivity, SessionStore.user.LoginPreference) + console.log(SessionStore.exist, SessionStore.user.Inactivity, SessionStore.user.LoginPreference) if(SessionStore.exist && SessionStore.user.Inactivity && SessionStore.user.LoginPreference != 'Pin' ) { this.router.navigate(['/home/events']); return false