diff --git a/src/app/adminauthguard.service.ts b/src/app/adminauthguard.service.ts index 63a8868..f7e795b 100644 --- a/src/app/adminauthguard.service.ts +++ b/src/app/adminauthguard.service.ts @@ -1,5 +1,4 @@ import { Injectable } from '@angular/core'; -import { CanActivate } from '@angular/router'; import { ActivatedRouteSnapshot, CanActivate, Router, RouterStateSnapshot } from '@angular/router'; import { Observable } from 'rxjs'; import { AdminauthService } from './adminauth.service'; @@ -13,15 +12,11 @@ export class AdminauthguardService implements CanActivate { canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot ): boolean | Promise | Observable{ - if (this.authService.isUserLoggedIn()) - { + if (this.authService.isUserLoggedIn()) { return true; + } else { + this.router.navigate(['home']); + return false; } - - else{ - - this.router.navigate(['home']); - return false; - - } + } }