lib/thunk.js
function loadEntity(name, promise, options) {
  if (!name || typeof name !== 'string') throw new Error('Missing required entity name');
  if (!promise || !promise.then) throw new Error('Missing required entity promise');

  try {
    !(0, _validateOptions.default)(options);
  } catch (error) {
    throw error;
  }

  var entityLifecycle = new _entityLifecycle.default(name, options);
  return function (dispatch, getState) {
    entityLifecycle.setDispatch(dispatch);
    entityLifecycle.setGetState(getState);
    entityLifecycle.onLoad();
    return new Promise(function (resolve, reject) {
      promise.then(function (data) {
        resolve(entityLifecycle.onSuccess(data));
      }).catch(function (error) {
        reject(entityLifecycle.onFailure(error));
      });
    });
  };
}
function loadEntity(name, promise, options) {
  if (!name || typeof name !== 'string') throw new Error('Missing required entity name');
  if (!promise || !promise.then) throw new Error('Missing required entity promise');

  try {
    !(0, _validateOptions.default)(options);
  } catch (error) {
    throw error;
  }

  var entityLifecycle = new _entityLifecycle.default(name, options);
  return function (dispatch, getState) {
    entityLifecycle.setDispatch(dispatch);
    entityLifecycle.setGetState(getState);
    entityLifecycle.onLoad();
    return new Promise(function (resolve, reject) {
      promise.then(function (data) {
        resolve(entityLifecycle.onSuccess(data));
      }).catch(function (error) {
        reject(entityLifecycle.onFailure(error));
      });
    });
  };
}
Redux thunk action creator for performing asynchronous actions.

@param {string}  name        Entity name
@param {Promise} promise     Promise (e.g. OrderService.getOrders())
@param {object}  options     Configuration options object
@return {function}           Perform an asynchronous action, dispatch Redux actions accordingly