UNPKG

lml-main

Version:

This is now a mono repository published into many standalone packages.

15 lines 1.21 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); // TODO: Remove when we have push const lodash_1 = require("lodash"); const redux_observable_1 = require("redux-observable"); const cosmo_redux_api_1 = require("@lml/cosmo-redux-api"); exports.postAllocationSuccess = (action$, store) => action$.ofType(cosmo_redux_api_1.POST_ALLOCATION.SUCCESS) .map(({ args: { jobRefId, courier } }) => cosmo_redux_api_1.setCourierById(Object.assign({}, courier, { allocated: Object.assign({}, courier.allocated, { [jobRefId]: { refId: jobRefId, jobRefId } }) }))); exports.postDeallocationSuccess = (action$, store) => action$.ofType(cosmo_redux_api_1.POST_DEALLOCATION.SUCCESS) .mergeMap(({ args: { jobRefId, courier } }) => [ cosmo_redux_api_1.setCourierById(Object.assign({}, courier, { allocated: lodash_1.omit(courier.allocated, jobRefId), accepted: lodash_1.omit(courier.accepted, jobRefId), progress: lodash_1.omit(courier.progress, jobRefId) })), cosmo_redux_api_1.fetchCourierJobs(courier.refId), ]); exports.postAllocationEpics = redux_observable_1.combineEpics(exports.postAllocationSuccess, exports.postDeallocationSuccess); //# sourceMappingURL=post-allocation.js.map