Skip to content

Instantly share code, notes, and snippets.

@productioncoder productioncoder/watch.js
Last active Nov 10, 2018

Embed
What would you like to do?
Youtube in React: consecutive requests in saga
export function* fetchWatchDetails(videoId) {
let requests = [
buildVideoDetailRequest.bind(null, videoId),
buildRelatedVideosRequest.bind(null, videoId),
];
try {
const responses = yield all(requests.map(fn => call(fn)));
yield put(watchActions.details.success(responses));
yield call (fetchVideoDetails, responses);
} catch (error) {
yield put(watchActions.details.failure(error));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.