FarmMapsLib/projects/common/src/fm/services/nav-bar-guard.service.ts
Willem Dantuma 9ebce8e0bb
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
Some refactoring
2019-11-05 17:19:33 +01:00

23 lines
699 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({
providedIn: 'root',
})
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;
}
}