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 {
ActionReducer,
ActionReducerMap,
createFeatureSelector,
createSelector,
MetaReducer
} from '@ngrx/store';
@ -24,10 +22,14 @@ export const reducers: ActionReducerMap<State> = {
// console.log all actions
export function logger(reducer: ActionReducer<State>): ActionReducer<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('next state', result);
console.groupEnd();
return reducer(state, action);
return result;
};
}