Skip to content

Instantly share code, notes, and snippets.

@productioncoder
Created November 3, 2018 09:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save productioncoder/b301e9bd1b9e133b1a5f2248a9646bed to your computer and use it in GitHub Desktop.
Save productioncoder/b301e9bd1b9e133b1a5f2248a9646bed to your computer and use it in GitHub Desktop.
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