21 lines
674 B
TypeScript
21 lines
674 B
TypeScript
|
import { Injectable } from '@angular/core';
|
||
|
import { CanLoad, Route, CanActivate, CanDeactivate, ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router';
|
||
|
|
||
|
import { Store } from '@ngrx/store';
|
||
|
|
||
|
import * as appCommonReducer from '../reducers/app-common.reducer'
|
||
|
import * as appCommonActions from '../actions/app-common.actions';
|
||
|
|
||
|
|
||
|
@Injectable()
|
||
|
export class NavBarGuard implements CanActivate {
|
||
|
|
||
|
private loginDispatched = false;
|
||
|
constructor(private store: Store<appCommonReducer.State>) { }
|
||
|
|
||
|
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): boolean {
|
||
|
this.store.dispatch(new appCommonActions.ShowNavBar());
|
||
|
return true;
|
||
|
}
|
||
|
}
|