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);
|
2015-10-19 09:02:10 +02:00
|
|
|
//debug('Store current state %j', store.getState());
|
2015-09-11 16:25:45 +02:00
|
|
|
next(action);
|
2015-10-19 09:02:10 +02:00
|
|
|
//debug('Store new state %j', store.getState());
|
2015-09-11 16:25:45 +02:00
|
|
|
if(action.error) {
|
|
|
|
console.error(action.error.stack || action.error);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|