lml-main
Version:
This is now a mono repository published into many standalone packages.
29 lines • 1.81 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const redux_observable_1 = require("redux-observable");
const redux_rx_http_1 = require("redux-rx-http");
const cosmoui_1 = require("cosmoui");
const actions_1 = require("../../frequencies/actions");
exports.putFrequencyAutoAllocationBatch = (action$, store) => action$.ofType(actions_1.UPDATE_FREQUENCY_AUTO_ALLOCATION_BATCH)
.mergeMap(({ setFrequencyAutoOn, setFrequencyAutoOff }) => {
let actions = [];
if (setFrequencyAutoOn.length > 0) {
actions.push(redux_rx_http_1.rxHttpPut(`/v2/joblabel/bulk-switch/labels`, actions_1.PUT_FREQUENCY_AUTO_ALLOCATION_BATCH, { auto: true, items: setFrequencyAutoOn }));
}
if (setFrequencyAutoOff.length > 0) {
actions.push(redux_rx_http_1.rxHttpPut(`/v2/joblabel/bulk-switch/labels`, actions_1.PUT_FREQUENCY_AUTO_ALLOCATION_BATCH, { auto: false, items: setFrequencyAutoOff }));
}
return actions;
});
exports.putFrequencyAutoAllocationBatchSuccess = (action$, store) => action$.ofType(actions_1.PUT_FREQUENCY_AUTO_ALLOCATION_BATCH.SUCCESS)
.mergeMap(() => [
actions_1.getFrequenciesData,
cosmoui_1.notificationSuccess('Frequency batch auto switch success.')
]);
exports.putFrequencyAutoAllocationBatchError = (action$, store) => action$.ofType(actions_1.PUT_FREQUENCY_AUTO_ALLOCATION_BATCH.ERROR)
.mergeMap(() => [
actions_1.getFrequenciesData,
cosmoui_1.notificationError('There was a problem with the batch auto swtich save. Please try again')
]);
exports.postBatchFrequencyAutoAllocationEpics = redux_observable_1.combineEpics(exports.putFrequencyAutoAllocationBatch, exports.putFrequencyAutoAllocationBatchSuccess, exports.putFrequencyAutoAllocationBatchError);
//# sourceMappingURL=post-batch-frequency-auto-allocation.js.map