【发布时间】:2017-06-10 12:14:42
【问题描述】:
const requestUserInfo = (state = {}, action) => {
switch(action.type) {
case 'HEADER_GET_USERINFO':
axios.post('/user/getScores', qs.stringify({
token: token,
uid: uid
}))
.then(res => {
if(res.data.status !== 200) {
message.error(res.data.message)
return state
}
return { ...res.data.attachment, ...state }
})
break
default :
return state
}
}
// error
Uncaught Error: Given action "HEADER_GET_USERINFO", reducer "requestUserInfo" returned undefined. To ignore an action, you must explicitly return the previous state.
【问题讨论】:
标签: reactjs react-redux axios