Checkpoint: Authentication

This commit is contained in:
aditya.chandel
2025-02-15 21:43:06 -07:00
parent e1685b2bf8
commit d3627a2d3f
25 changed files with 669 additions and 60 deletions
+13
View File
@@ -0,0 +1,13 @@
import {inject} from '@angular/core';
import {CanActivateFn, Router} from '@angular/router';
export const AuthGuard: CanActivateFn = (route, state) => {
const router = inject(Router);
const token = localStorage.getItem('token');
if (!token) {
router.navigate(['/login']);
return false;
}
return true;
};