Skip to content

Instantly share code, notes, and snippets.

@productioncoder productioncoder/video.js
Last active Oct 27, 2018

Embed
What would you like to do?
Youtube fetch most popular videos by category saga
import {fork, take, takeEvery, call, all, put} from 'redux-saga/effects';
/* ... */
import {fetchEntity, ignoreErrors} from './index';
export function* fetchMostPopularVideosByCategory(categories) {
const requests = categories.map(category => {
const wrapper = ignoreErrors(api.buildMostPopularVideosRequest, 12, false, null, category);
return call(wrapper);
});
try {
const response = yield all(requests);
yield put(videoActions.mostPopularByCategory.success(response, categories));
} catch (error) {
yield put(videoActions.mostPopularByCategory.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.