How to use the @ngrx/router-store.routerActions.UPDATE_LOCATION function in @ngrx/router-store

To help you get started, we’ve selected a few @ngrx/router-store examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github bave8672 / angular-firebase-starter / src / app / store / nav / nav.reducer.ts View on Github external
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;
        }
});