pitaya-launcher/js/store/middlewares/logger.js

16 lines
437 B
JavaScript
Raw Normal View History

2015-09-11 16:25:45 +02:00
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);
}
};
};
};