Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
...
import {setTracks} from '../actions/track';
...
export function auth() {
return (dispatch) => {
SoundCloud.connect().then((session) => {
dispatch(fetchMe(session));
dispatch(fetchTracks(session));
});
}
}
...
function fetchTracks(session) {
return (dispatch) => {
fetch(`${API_HOST}/me/activities?limit=20&offset=0&oauth_token=${session.oauth_token}`)
.then((res) => res.json())
.then((data) => {
dispatch(setTracks(data.collection));
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment