adjusted AuthGuard for BehaviorSubject in AccountService
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
import { Auth.Guard } from './auth.guard';
|
import { AuthGuard } from './auth.guard';
|
||||||
|
|
||||||
describe('Auth.Guard', () => {
|
describe('Auth.Guard', () => {
|
||||||
it('should create an instance', () => {
|
it('should create an instance', () => {
|
||||||
expect(new Auth.Guard()).toBeTruthy();
|
expect(new AuthGuard()).toBeTruthy();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ export class AuthGuard implements CanActivate {
|
|||||||
private accountService: AccountService) { }
|
private accountService: AccountService) { }
|
||||||
|
|
||||||
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): boolean {
|
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): boolean {
|
||||||
const user = this.accountService.userName;
|
const user = this.accountService.userValue;
|
||||||
|
|
||||||
if (user) {
|
if (user) {
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
Reference in New Issue
Block a user