lml-main
Version:
This is now a mono repository published into many standalone packages.
38 lines • 1.59 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
var redux_observable_1 = require("redux-observable");
var cosmoui_1 = require("cosmoui");
var actions_1 = require("../actions");
exports.fetchJobByIdSuccess = function (action$, store) {
return action$.ofType(actions_1.FETCH_JOB_BY_ID.SUCCESS)
.mergeMap(function (action) {
var res = [];
var _a = action.result, job = _a.job, jobStatus = _a.jobStatus, incidents = _a.incidents, jobAudit = _a.jobAudit, jobDelay = _a.jobDelay, scrMatches = _a.scrMatches;
var refId = action.args.refId;
if (job) {
res.push(actions_1.setJobById(job));
}
if (jobStatus) {
res.push(actions_1.setJobStatusById(jobStatus));
}
if (incidents) {
res.push(actions_1.setJobIncidents(refId, incidents));
}
if (jobAudit) {
res.push(actions_1.setJobAudit(refId, jobAudit));
}
if (jobDelay) {
res.push(actions_1.setJobDelay(refId, jobDelay));
}
if (scrMatches) {
res.push(actions_1.setSmartMatches(refId, scrMatches));
}
return res;
});
};
exports.fetchJobByIdError = function (action$, store) {
return action$.ofType(actions_1.FETCH_JOB_BY_ID.ERROR)
.mapTo(cosmoui_1.notificationError('There was a problem fetching the selected job. Please refresh.'));
};
exports.fetchJobByIdEpics = redux_observable_1.combineEpics(exports.fetchJobByIdSuccess, exports.fetchJobByIdError);
//# sourceMappingURL=fetch-job-by-id.js.map