src/handlers/handle-success.js
function handleSuccess (handler) {
  return (state, action) => isSuccessAction(action) ? handler(state, action, getDataFromAction(action)) : state
}
function handleSuccess (handler) {
  return (state, action) => isSuccessAction(action) ? handler(state, action, getDataFromAction(action)) : state
}
function handleSuccess ( handler ) { return ( state , action ) => isSuccessAction ( action ) ? handler ( state , action , getDataFromAction ( action ) ) : state }
A function that takes an API action handler and only applies that handler when the request succeeds.

@name handleSuccess
@param {Function} handler - An action handler that is passed `state`, `action` and `data` params
@returns {Function} An action handler that runs when a request is successful
@example

handleActions({
[apiActions.fetchUser]: handleSuccess((state, action) => {
// This code only runs when the call was successful
return set('currentUser', action.payload.data, state)
})
})
A function that takes an API action handler and only applies that handler when the request succeeds .