Skip to content

Instantly share code, notes, and snippets.

@adnaan
Created November 2, 2016 04:56
Show Gist options
  • Save adnaan/5a86e84721ab1a3cac42a63792eddd6d to your computer and use it in GitHub Desktop.
Save adnaan/5a86e84721ab1a3cac42a63792eddd6d to your computer and use it in GitHub Desktop.
effects: { * query(_, { call, put }: { call: Function, put: Function }) {
const { success, data } = yield call(getProducts);
if (success) {
yield put({
type: 'querySuccess',
products: data,
});
}
},
* vote({ id }: { id: number }, { call, put }: { call: Function, put: Function }) {
const { success } = yield call(updateVote, id);
if (success) {
yield put({
type: 'voteSuccess',
id,
});
}
},
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment