Skip to content

Instantly share code, notes, and snippets.

@martinkadlec0
Created May 4, 2018 08:43
Show Gist options
  • Select an option

  • Save martinkadlec0/85d414648299a454ddfc45ee0d788667 to your computer and use it in GitHub Desktop.

Select an option

Save martinkadlec0/85d414648299a454ddfc45ee0d788667 to your computer and use it in GitHub Desktop.
const fetchSaga = function* fetchSaga(action) {
// objScanned -> itemScanned as I assume that was a typo?
const itemScanned = yield call(scanProduct, action.payload.id);
const {id, user} = action.payload;
try {
const result = yield cps(AxusLogger.logScan, {id, user});
// Or like this if logScan needs AxusLogger context:
// const result = yield cps([AxusLogger, 'logScan'], {id, user});
dispatchScan(result);
const product = {
id: itemScanned.id,
name: itemScanned.itemId.name,
};
yield put(scanProductCompleted(itemScanned));
yield put(navigate('Product Details', { product, from: 'home' }));
} catch (err) {
yield put(navigate('Home'));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment