Я новичок в React & Redux.
export function* putMatchesAsync({payload}) {
console.log('putMatchesAsync');
try {
const { resMatch } = yield axios.put(baseUrl + apiEndPoint + payload.id, payload);
yield put(putMatchesSuccess(resMatch))
} catch (error) {
yield put(putMatchesFailure(error.message))
}
}
, используя этот код, я хотел бы использовать putMatchesSuccess или putMatchesFailure в качестве реквизита. Возможно ли это?
const FixtureDetailItem = ({ type, match, teams, isAdmin, postMatchesStart, putMatchesStart, postMatchesSuccess, putMatchesSuccess }) => {
return (
console.log(putMatchesSuccess)
console.log(putMatchesFail)
)
}
const mapDispatchToProps = dispatch => ({
postMatchesStart: (matches) => dispatch(postMatchesStart(matches)),
putMatchesStart: (matches) => dispatch(putMatchesStart(matches)),
postMatchesSuccess: (matches) => dispatch(postMatchesSuccess(matches)),
putMatchesSuccess: (matches) => dispatch(putMatchesSuccess(matches))
})
Моя конечная цель: как только я получу тип ошибки, я покажу предупреждение пользователю, и как только я добьюсь успеха, я бы хотел обновить состояние isPutSuccess. Кто-нибудь может помочь?