Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import { ActionMap } from '../../helpers/actionMap';
import { assign } from '../../helpers/assign';
import { compose } from '@ngrx/core';
import { routerActions } from '@ngrx/router-store';
import { ActionReducer } from '@ngrx/store';
export const NavReducer = compose, ActionReducer, ActionReducer>(
useDefaultState(DefaultNavState),
hashReducer
)({
[NavActionTypes.ToggleNavigation]:
(state, _) => assign(state, { showNavigation: !state.showNavigation }),
[routerActions.UPDATE_LOCATION]:
(state, _) => {
if (state.showNavigation) {
return assign(state, { showNavigation: false });
}
return state;
}
});