1
0
mirror of https://github.com/aclindsa/moneygo.git synced 2024-11-10 18:00:05 -05:00
moneygo/js/reducers/ErrorReducer.js

18 lines
440 B
JavaScript
Raw Normal View History

2016-10-05 13:36:47 -04:00
var ErrorConstants = require('../constants/ErrorConstants');
var Error = require('../models').Error;
module.exports = function(state = new Error(), action) {
switch (action.type) {
case ErrorConstants.ERROR_AJAX:
case ErrorConstants.ERROR_SERVER:
case ErrorConstants.ERROR_CLIENT:
case ErrorConstants.ERROR_USER:
return action.error;
case ErrorConstants.CLEAR_ERROR:
return new Error();
default:
return state;
}
};