@cgnal/redux/saga

Utilities for redux-saga.

Source:

Methods

(static) resultHandler(makeCallEffect, successCreators, failureCreators) → {GeneratorFunction}

Source:
Since:
  • 0.0.12
See:

Builds a generator function that will perform the call effect built by the given maker function.
It will yield all the put effects created from successCreators if the call effect is successful or from failureCreators otherwise.

Parameters:
Name Type Description
makeCallEffect function

Action => callEffect:Object

successCreators Array.<function()>
failureCreators Array.<function()>
Returns:
Type
GeneratorFunction

(static) sagaPromiseTransformer(request) → {Promise}

Source:
Since:
  • 0.0.1

A transformer function meant to be used in the options of services' helpers like HttpTransport.
In the case above, the function will transform the HTTP request in a redux-saga cancellable Promise which is able to abort the request and will resolve to { result: Response } and reject to { error: Error }.

Parameters:
Name Type Description
request Request
Returns:
Type
Promise

(static) toCallEffect(fn, getArgsFromActionopt) → {function}

Source:
Since:
  • 0.0.12

Helper to build a redux-saga call effect.
Expects the function to call, and a second function, that will receive the involved action as argument and should return the array of parameters for the first one.

Parameters:
Name Type Attributes Default Description
fn function
getArgsFromAction function <optional>
() => []
Returns:

Action => callEffect:Object

Type
function