This effect is used when describing the FAILURE
case of the SUCCESS-FAILURE
pattern.
This effect is a multi-target effect - It modifies more than one target at the same time.
It will:
- Put
${action.target}Loading
infalse
- Put
${action.target}Error
with youraction.payload
by default. - Put
${action.target}IsRetrying
infalse
ifaction.isPolling
is truthy - Put
${action.target}CountRetry
in0
ifaction.isPolling
is truthy
Example:
const reducerDescription = {
[actions.ON_FETCH_FAILURE]: onFailure()
}
onFailure
effect receives an optional parameter:
- selector: This function describes how we read the error from the
action
.
(action, state) => any
By default, is:
action => action.payload