Skip to content

Instantly share code, notes, and snippets.

@jackcallister
Last active August 29, 2015 14:26
Show Gist options
  • Save jackcallister/689c18166ea4a99680b7 to your computer and use it in GitHub Desktop.
Save jackcallister/689c18166ea4a99680b7 to your computer and use it in GitHub Desktop.
// WebUtils
WebUtils = {
fetchMe: function(opts) {
return new Promise(function(resolve, reject) {
request.get(`${SOUNDCLOUD_URL}/me`)
.query(opts)
.end((err, res) => { me: res.body });
}
});
}
}
// Action creator
export const beginFetchMe = (opts) => {
return {
promise: WebUtils.fetchMe(opts),
types: [BEGIN_FETCHING_ME, SUCCESS_FETCHING_ME, ERROR_FETCHING_ME]
}
};
export const successFetchMe = (responseBody) => {
return {
payload: responseBody,
type: SUCCESS_FETCHING_ME
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment