Skip to content

Commit d000f36

Browse files
author
Your Name
committed
NgRx - The Complete Guide
1 parent e612928 commit d000f36

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

src/app/reducers/index.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,19 @@ export const reducers: ActionReducerMap<AppState> = {
1616
router: routerReducer
1717
};
1818

19+
export function logger(reducer:ActionReducer<any>)
20+
: ActionReducer<any> {
21+
return (state, action) => {
22+
console.log("state before: ", state);
23+
console.log("action", action);
24+
25+
return reducer(state, action);
26+
}
27+
28+
}
29+
1930

2031
export const metaReducers: MetaReducer<AppState>[] =
21-
!environment.production ? [] : [];
32+
!environment.production ? [logger] : [];
33+
34+

0 commit comments

Comments
 (0)