How to use the react-async.ActionTypes.reject function in react-async

To help you get started, we’ve selected a few react-async examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github async-library / react-async / packages / react-async-devtools / src / index.js View on Github external
globalScope.__REACT_ASYNC__.devToolsDispatcher = (action, dispatch) => {
  const run = () => {
    dispatch(action)
    state.update(action)
  }
  switch (action.type) {
    case ActionTypes.start:
      if (state.intercept) {
        dispatch({ ...action, payload: undefined })
        state.update(action, run)
      } else run()
      break
    case ActionTypes.fulfill:
    case ActionTypes.reject:
      setTimeout(run, state.latency * 1000)
      break
    default:
      run()
  }
}