This commit is contained in:
crusader 2018-10-05 11:18:57 +09:00
parent 1c4183c62c
commit 1be35047cf

View File

@ -3,8 +3,6 @@ import { Type } from '@angular/core';
import { import {
ActionReducer, ActionReducer,
ActionReducerMap, ActionReducerMap,
createFeatureSelector,
createSelector,
MetaReducer MetaReducer
} from '@ngrx/store'; } from '@ngrx/store';
@ -24,10 +22,14 @@ export const reducers: ActionReducerMap<State> = {
// console.log all actions // console.log all actions
export function logger(reducer: ActionReducer<State>): ActionReducer<State> { export function logger(reducer: ActionReducer<State>): ActionReducer<State> {
return function (state: State, action: any): State { return function (state: State, action: any): State {
console.log('state', state); const result = reducer(state, action);
console.groupCollapsed(action.type);
console.log('prev state', state);
console.log('action', action); console.log('action', action);
console.log('next state', result);
console.groupEnd();
return reducer(state, action); return result;
}; };
} }