Skip to content

Instantly share code, notes, and snippets.



Last active Dec 16, 2018
What would you like to do?
Most popular video sagas
import {call, fork, take } from 'redux-saga/effects';
import * as api from '../api/youtube-api';
import * as videoActions from '../actions/video';
import {REQUEST} from '../actions';
import {fetchEntity} from './index';
export function* watchMostPopularVideos() {
while (true) {
const {amount, loadDescription, nextPageToken} = yield take(videoActions.MOST_POPULAR[REQUEST]);
yield fork(fetchMostPopularVideos, amount, loadDescription, nextPageToken);
export function* fetchMostPopularVideos(amount, loadDescription, nextPageToken) {
const request = api.buildMostPopularVideosRequest.bind(null, amount, loadDescription, nextPageToken);
yield fetchEntity(request, videoActions.mostPopular);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment