Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Youtube watch details worker saga first version
import {fork, take, all, put, call} from 'redux-saga/effects';
import * as watchActions from '../actions/watch';
import {buildVideoDetailRequest} from '../api/youtube-api';
export function* fetchWatchDetails(videoId) {
let requests = [
buildVideoDetailRequest.bind(null, videoId),
];
try {
const responses = yield all(requests.map(fn => call(fn)));
yield put(watchActions.details.success(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.