async-connect
Version:
HOC for calling and statusing redux actions on componentDidMount
29 lines (22 loc) • 725 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
var _actionTypes = require('../actionTypes');
var _config = require('./config');
var _reactRouterRedux = require('react-router-redux');
var _lib = require('./lib');
exports.default = function () {
var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _config.INITIAL_STATE;
var action = arguments[1];
switch (action.type) {
case _actionTypes.STATUS:
return (0, _lib.mapStatus)(state, action);
case _actionTypes.ERROR:
return (0, _lib.mapError)(state, action);
case _reactRouterRedux.LOCATION_CHANGE:
return (0, _lib.mapLocationChange)();
default:
return state;
}
};