Last active
June 17, 2019 18:47
-
-
Save lukebrandonfarrell/8c1508e6d62e4ceaac3a5a211c337d26 to your computer and use it in GitHub Desktop.
An abstract saga example from the redux saga network layer pattern.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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