rollback guard

This commit is contained in:
Daniel Ponte 2024-11-22 14:13:52 -05:00
parent 81aa96a77b
commit ee7a44cd4b

View file

@ -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;
}
};