lml-main
Version:
This is now a mono repository published into many standalone packages.
19 lines • 1.03 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
var redux_observable_1 = require("redux-observable");
var ts_utils_1 = require("@lml/ts-utils");
var actions_1 = require("../actions");
var cosmoui_1 = require("cosmoui");
exports.fetchJobLabelsSuccess = function (action$, store) {
return action$.ofType(actions_1.FETCH_JOB_LABELS.SUCCESS)
.map(function (action) {
var result = action.result;
return actions_1.setJobLabels(ts_utils_1.arrayToMap(result.regions, 'name'), ts_utils_1.arrayToMap(result.serviceCentres, 'code'), ts_utils_1.arrayToMap(result.labels, 'label'));
});
};
exports.fetchJobLabelsError = function (action$, store) {
return action$.ofType(actions_1.FETCH_JOB_LABELS.ERROR)
.mapTo(cosmoui_1.notificationError('Failed to fetch jobLabels at start up. Please refresh'));
};
exports.fetchJobLabelEpics = redux_observable_1.combineEpics(exports.fetchJobLabelsSuccess, exports.fetchJobLabelsError);
//# sourceMappingURL=fetch-job-labels.js.map