Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Youtube in React: video details for watch component
function* fetchVideoDetails(responses) {
const searchListResponse = responses.find(response => response.result.kind === SEARCH_LIST_RESPONSE);
const relatedVideoIds = searchListResponse.result.items.map(relatedVideo => relatedVideo.id.videoId);
const requests = relatedVideoIds.map(relatedVideoId => {
return buildVideoDetailRequest.bind(null, relatedVideoId);
});
try {
const responses = yield all(requests.map(fn => call(fn)));
yield put(watchActions.videoDetails.success(responses));
} catch (error) {
yield put(watchActions.videoDetails.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.