Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
* handleDidMount () {
try {
const matchSelector = createMatchSelector({ path: '/posts/:id' });
const match = yield select(matchSelector);
const id = parseInt(match.params.id, 10);
yield put(setLoading());
const { success, error } = yield call(getPostAPI, id);
if (success) {
yield put(setPost(success.body));
yield call(sagas.getUser, success.body.userId);
} else {
console.log(error);
yield put(setFailure());
}
} catch (err) {
console.log(err);
}
},