未捕获(在promise中)TypeError:无法读取undefined的属性

时间:2017-02-15 06:41:28

标签: javascript reactjs redux

我有一个传奇,会向商店发送SIGNIN动作。

const { status, userDetails: {token} } = yield take(SIGNIN);
yield put({ type:SIGNIN, payload: {status, token} });

reducer内,我可以记录payload,其中包含status and token的属性和值,

authenticated: createReducer(userAuthenticated, {
    [SIGNIN](state, action) {
        console.log(action.payload);
    }
})

但是当我尝试通过payload object访问console.log(action.payload.status)内的属性时,我得到了Uncaught (in promise) TypeError: Cannot read property 'status' of undefined。我们是不是想在reducer中访问有效负载对象的属性?

0 个答案:

没有答案