Sha256: 779b594a47ed4452062ed295a8814a8c0dfb12ed4cadfd5617725b9f4ce33083
Contents?: true
Size: 870 Bytes
Versions: 2
Compression:
Stored size: 870 Bytes
Contents
/* eslint no-console: 0 */ import _ from 'lodash'; // This logger should be configured not to run in a production environment. // See https://github.com/petehunt/webpack-howto#6-feature-flags for you might turn this off for production. export default function logger({ getState }) { return next => action => { console.log('will dispatch', action); // Call the next dispatch method in the middleware chain. const result = next(action); // We can't console.log immutable objects out-of-the-box. const immutableState = getState(); const readableState = _.reduce(immutableState, (result, immutable, key) => { result[key] = immutable.toJS(); }, {}); console.log('state after dispatch', readableState); // This will likely be the action itself, unless // a middleware further in chain changed it. return result; }; }
Version data entries
2 entries across 2 versions & 1 rubygems