Skip to content

Instantly share code, notes, and snippets.

@lukebrandonfarrell
Last active June 17, 2019 18:47
Show Gist options
  • Save lukebrandonfarrell/8c1508e6d62e4ceaac3a5a211c337d26 to your computer and use it in GitHub Desktop.
Save lukebrandonfarrell/8c1508e6d62e4ceaac3a5a211c337d26 to your computer and use it in GitHub Desktop.
An abstract saga example from the redux saga network layer pattern.
import { all, call, takeLatest } from "redux-saga/effects";
import { FETCH_USER_ORDERS_REQUEST, FETCH_USER_ORDERS_RESPONSE } from "../types";
import { fetchOrdersRequest } from "../api";
import { AbstractAPISaga } from "../AbstractAPISaga";
export default function* UserOrdersSaga (baseUrl) {
yield all([
yield takeLatest(FETCH_USER_ORDERS_REQUEST,
action => AbstractAPISaga(action, baseUrl, fetchOrdersRequest, FETCH_USER_ORDERS_RESPONSE)
]);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment