resources/assets/js/app-v1/utils/redux/utils/sagas.js
/**
 * Takes an action with a payload and runs it through a handler function, which
 * in turn dispatches a new action with the payload data
 * 
 * @param {string} causeAction The action to 'take'/handle
 * @param {string} effectAction The action being dispatched with the generated payload
 * @param {function} actionPayloadHandler A function that returns the payload to send with the effect
 * action.
 */
Takes an action with a payload and runs it through a handler function, which
in turn dispatches a new action with the payload data

@param {string} causeAction The action to 'take'/handle
@param {string} effectAction The action being dispatched with the generated payload
@param {function} actionPayloadHandler A function that returns the payload to send with the effect
action.
Takes an action with a payload and runs it through a handler function which in turn dispatches a new action with the payload data @param { string } causeAction The action to ' take ' / handle @param { string } effectAction The action being dispatched with the generated payload @param { function } actionPayloadHandler A function that returns the payload to send with the effect action .
function createCauseAndEffectSaga(causeAction, effectAction, actionPayloadHandler){
    invariant( _.isFunction(actionPayloadHandler), 'Expected actionPayloadHandler to be a function')
    function* callback(action) {
        try {
            const { payload: { data }} = action || { payload: { data: {}}}
            if(!data || data.length == 0){
                return
            } else {
                const payloadData = yield call(actionPayloadHandler, action.payload.data)
                yield put({
                    type: effectAction,
                    payload: payloadData
                })
            }
        } catch(e){
        }
    }
    return function* watcherSaga() {
        yield takeLatest(causeAction, callback)
    }
}
function createCauseAndEffectSaga ( causeAction , effectAction , actionPayloadHandler ) { invariant ( _ . isFunction ( actionPayloadHandler ) , 'Expected actionPayloadHandler to be a function' ) function * callback ( action ) { try { const { payload : { data } } = action || { payload : { data : { } } } if ( ! data || data . length == 0 ) { return } else { const payloadData = yield call ( actionPayloadHandler , action . payload . data ) yield put ( { type : effectAction , payload : payloadData } ) } } catch ( e ) { } } return function * watcherSaga ( ) { yield takeLatest ( causeAction , callback ) } }
Takes an action with a payload and runs it through a handler function, which
 in turn dispatches a new action with the payload data
Takes an action with a payload and runs it through a handler function which in turn dispatches a new action with the payload data