function middleware({ dispatch } = {}) {
  if (typeof dispatch === 'function') {
    return createPromise()({ dispatch });
  }

  if (process && process.env && process.env.NODE_ENV !== 'production') {
    // eslint-disable-next-line no-console
    console.warn(`Redux Promise Middleware: As of version 6.0.0, the \
middleware library supports both preconfigured and custom configured \
middleware. To use a custom configuration, use the "createPromise" export \
and call this function with your configuration property. To use a \
preconfiguration, use the default export. For more help, check the upgrading \
guide: https://docs.psb.design/redux-promise-middleware/upgrade-guides/v6

For custom configuration:
import { createPromise } from 'redux-promise-middleware';
const promise = createPromise({ promiseTypeSuffixes: ['LOADING', 'SUCCESS', 'ERROR'] });
applyMiddleware(promise);

For preconfiguration:
import promise from 'redux-promise-middleware';
applyMiddleware(promise);
    `);
  }

  return null;
}
Second, dispatch a rejected or fulfilled action and move on to the
next middleware.