Sha256: ad753f90b10192c9683aab053fc0446f82692d762a64389ad7e69c452216c4fc

Contents?: true

Size: 694 Bytes

Versions: 2

Compression:

Stored size: 694 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);

    const immutableState = getState();

    console.log('state after dispatch', JSON.stringify(immutableState));

    // 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

Version Path
react_on_rails-1.0.3 lib/generators/react_on_rails/templates/redux/base/client/app/lib/middlewares/loggerMiddleware.js
react_on_rails-1.0.2 lib/generators/react_on_rails/templates/redux/base/client/app/lib/middlewares/loggerMiddleware.js