Sawtaytoes
10/16/2019 - 7:35 AM

dispatchOnError

const dispatchOnError = (
  actionCreator,
  returnValue,
) => (
  catchError((
    error,
  ) => {
    dispatch(
      actionCreator(
        error,
      )
    )

    return (
      returnValue
      ? of(returnValue)
      : EMPTY
    )
  })
)