docs: add JSDoc comments to AuthGuard
This commit is contained in:
parent
daf23c1c5c
commit
c2ea6c8762
1 changed files with 6 additions and 0 deletions
|
|
@ -10,6 +10,12 @@ import { LoginService } from './services/auth.service';
|
||||||
export class AuthGuard {
|
export class AuthGuard {
|
||||||
constructor(private loginService: LoginService, private router: Router) {}
|
constructor(private loginService: LoginService, private router: Router) {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The canActivate guard checks if the user is authenticated.
|
||||||
|
* If the user is authenticated, the guard returns true.
|
||||||
|
* If the user is not authenticated, the guard navigates to the root route and returns false.
|
||||||
|
* If an error occurs during the authentication check, the guard navigates to the root route and returns false.
|
||||||
|
*/
|
||||||
canActivate(): Observable<boolean> | Promise<boolean> | boolean {
|
canActivate(): Observable<boolean> | Promise<boolean> | boolean {
|
||||||
return this.loginService.checkAuthUser().pipe(
|
return this.loginService.checkAuthUser().pipe(
|
||||||
map((isAuthenticated) => {
|
map((isAuthenticated) => {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue