Что не так с кодом ниже? Я получил async - ошибка зарезервированного слова, у меня настроен babel для async / await.
export async function getCredit(){
return dispatch => {
try {
const creditInfo = await axios.get(`/credit`)
} catch (err) {
dispatch(errorMsg(err.data.msg))
}
if(creditInfo.result === 200 && res.data.status === 1) {
dispatch({
type: GET_CREDIT,
payload: creditInfo.data
})
}
}
}
Я даже попробовал это
export async getCredit() => dispatch => {
try {
const creditInfo = await axios.get(`/credit`)
} catch (err) {
dispatch(errorMsg(err.data.msg))
}
if(creditInfo.result === 200 && res.data.status === 1) {
dispatch({
type: GET_CREDIT,
payload: creditInfo.data
})
}
}