16 lines
437 B
JavaScript
16 lines
437 B
JavaScript
|
var debug = require('../../util/debug')('store:logger');
|
||
|
|
||
|
module.exports = function loggerMiddleware(store) {
|
||
|
return function(next) {
|
||
|
return function(action) {
|
||
|
debug('Action %j', action);
|
||
|
debug('Store current state %j', store.getState());
|
||
|
next(action);
|
||
|
debug('Store new state %j', store.getState());
|
||
|
if(action.error) {
|
||
|
console.error(action.error.stack || action.error);
|
||
|
}
|
||
|
};
|
||
|
};
|
||
|
};
|