Example #1
0
export const requestProfile: ThunkActionCreator<Promise<Linode.Profile>> = () => (dispatch) => {
  const { started, done, failed } = getProfileActions;

  dispatch(started());

  return getProfile()
    .then(response => response.data)
    .then(maybeRequestGrants)
    .then((response) => {
      dispatch(done({ result: response }));
      return response;
    })
    .catch((error) => {
      dispatch(failed({ error }));
      return error;
    });
};
Example #2
0
> = () => dispatch => {
  const { started, done, failed } = getProfileActions;

  dispatch(started());

  return getProfile()
    .then(response => response.data)
    .then(maybeRequestGrants)
    .then(response => {
      dispatch(done({ result: response }));
      return response;
    })
    .catch(error => {
      dispatch(failed({ error }));
      return error;
    });
};