From ee7a44cd4b1e7c835c1c3d1a81fcdc4c4f79ee8a Mon Sep 17 00:00:00 2001 From: Daniel Ponte Date: Fri, 22 Nov 2024 14:13:52 -0500 Subject: [PATCH] rollback guard --- client/admin/src/app/auth.guard.ts | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/client/admin/src/app/auth.guard.ts b/client/admin/src/app/auth.guard.ts index d45e6dc..f5065e2 100644 --- a/client/admin/src/app/auth.guard.ts +++ b/client/admin/src/app/auth.guard.ts @@ -1,14 +1,9 @@ -import { Router, CanActivate, ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router'; +import { CanActivateFn } from '@angular/router'; -export class AuthGuard implements CanActivate { - constructor(private router: Router) { } - - canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot) { - if (sessionStorage.getItem('jwt') != null) { - return true; - } - - this.router.navigate(['/login'], { queryParams: { returnUrl: state.url }}); +export const AuthGuard: CanActivateFn = (route, state) => { + if (sessionStorage.getItem('jwt') == null) { return false; + } else { + return true; } };