UNPKG

lml-main

Version:

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

24 lines 1.51 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const redux_observable_1 = require("redux-observable"); const redux_rx_http_1 = require("redux-rx-http"); const selectors_1 = require("../../frequencies/selectors"); const actions_1 = require("../../frequencies/actions"); exports.postFrequencyAutoAllocation = (action$, store) => action$.ofType(actions_1.SET_FREQUENCY_AUTO_ALLOCATION) .map((action) => { const { label, autoIsOn } = action; const body = { auto: action.autoIsOn }; const args = { label, autoIsOn }; const config = { args }; return redux_rx_http_1.rxHttpPost(`/v2/joblabel/switch/${action.label}`, actions_1.POST_FREQUENCY_AUTO_ALLOCATION, body, config); }); exports.postFrequencyAutoAllocationSuccess = (action$, store) => action$.ofType(actions_1.POST_FREQUENCY_AUTO_ALLOCATION.SUCCESS) .map(action => { const { label, autoIsOn } = action.args; const counterpartLabel = selectors_1.getFrequencyIdCounterpartId(store.getState(), label); return actions_1.setFrequencyAutoIsOn(label, counterpartLabel, autoIsOn); }); exports.postFrequencyAutoAllocationError = (action$, store) => action$.ofType(actions_1.POST_FREQUENCY_AUTO_ALLOCATION.ERROR) .mapTo({ type: 'NOOP' }); exports.postFrequencyAutoAllocationEpics = redux_observable_1.combineEpics(exports.postFrequencyAutoAllocation, exports.postFrequencyAutoAllocationSuccess, exports.postFrequencyAutoAllocationError); //# sourceMappingURL=post-frequency-auto-allocation.js.map