import * as fromRouter from '@ngrx/router-store' ; /**
 * storeFreeze prevents state from being mutated. When mutation occurs, an
 * exception will be thrown. This is useful during development mode to
 * ensure that none of the reducers accidentally mutates the state.
 */ import { storeFreeze } from 'ngrx-store-freeze' ; import { RouterStateUrl } from '../../../../shared/utils' ; import { ActionReducerMap , ActionReducer , MetaReducer } from '@ngrx/store' ; import { environment } from '../../../../../environments/environment' ; /**
 * As mentioned, we treat each reducer like a table in a database. This means
 * our top level state interface is just a map of keys to inner state types.
 */ export interface State { routerReducer : fromRouter . RouterReducerState < RouterStateUrl > ; } /**
 * Our state is composed of a map of action reducer functions.
 * These reducer functions are called with each dispatched action
 * and the current or initial state and return a new immutable state.
 */ export const reducers = { routerReducer : fromRouter . routerReducer } ; export function logger ( reducer ) { return function ( state , action ) : State { console . log ( 'state' , state ) ; console . log ( 'action' , action ) ; console . log ( 'payload' , action . payload ) ; return reducer ( state , action ) ; } ; } /**
 * By default, @ngrx/store uses combineReducers with the reducer map to compose
 * the root meta-reducer. To add more meta-reducers, provide an array of meta-reducers
 * that will be composed to form the root meta-reducer.
 */ export const metaReducers = ! environment . production ? [ logger , storeFreeze ] : [ ] ;