UNPKG

lml-main

Version:

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

28 lines 1.24 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var redux_observable_1 = require("redux-observable"); var cosmoui_1 = require("cosmoui"); var actions_1 = require("../actions"); exports.fetchCouriersByStatusSuccess = function (action$, store) { return action$.ofType(actions_1.FETCH_COURIERS_BY_STATUS.SUCCESS) .mergeMap(function (action) { var state = store.getState(); var callsigns = action.result .reduce(function (acc, curr) { var callsign = curr.assignment.callsign; acc[callsign] = curr.refId; return acc; }, {}); var res = [ actions_1.setCouriersByIdBatch(action.result), actions_1.setCourierCallsigns(callsigns), ]; return res; }); }; exports.fetchCouriersByStatusError = function (action$, store) { return action$.ofType(actions_1.FETCH_COURIERS_BY_STATUS.ERROR) .mapTo(cosmoui_1.notificationError('There was a problem fetching couriers. Please refresh')); }; exports.fetchCouriersByStatusEpics = redux_observable_1.combineEpics(exports.fetchCouriersByStatusSuccess, exports.fetchCouriersByStatusError); //# sourceMappingURL=fetch-couriers-by-status.js.map