Last active
July 15, 2019 18:14
-
-
Save radzserg/58cb3d9274b65a02c77ce6ee8e907b51 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| export default function* configureSagas() { | |
| yield all([ | |
| watchLoadProducts(), | |
| watchSaveProduct(), | |
| // all the watchers that we need from all | |
| // parts of our app | |
| ]); | |
| } | |
| // and a specfic saga will look like | |
| import backendApi from "./path/to/backendApi"; | |
| import history form "./configureHistory"; | |
| export function* watchSaveProduct() { | |
| yield takeEvery(SAVE_PRODUCT, saveProduct); | |
| } | |
| export function* saveProduct( | |
| action: ISaveProductAction | |
| ) { | |
| const userDetails = backendApi.saveProduct(action.productId, action.productData); | |
| yield put(saveUserDetails(userDetails)); | |
| history.push("/products"); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment