Last active
August 29, 2015 14:26
-
-
Save jackcallister/689c18166ea4a99680b7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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