redux-saga-routines
Version:
Routines for redux-saga also useful with redux-form
31 lines (28 loc) • 773 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = bindRoutineToReduxForm;
var _constants = require("./constants");
function bindRoutineToReduxForm(routine) {
var noSuccessPayload = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
return function (values, dispatch, props) {
return new Promise(function (resolve, reject) {
return dispatch({
type: _constants.ROUTINE_PROMISE_ACTION,
payload: {
values: values,
props: props
},
meta: {
defer: {
resolve: resolve,
reject: reject
},
routine: routine,
noSuccessPayload: noSuccessPayload
}
});
});
};
}