Skip to content

Instantly share code, notes, and snippets.

Last active October 27, 2018 14:18
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
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 = => {
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