未触发动作捕获

时间:2019-02-28 15:45:20

标签: javascript reactjs

我有始终返回Promise.reject的操作:

module.exports = { create: createActionAsync('CREATE_USER', () => {
    return Promise.reject({
        response: {
            type: 'error',
            message: 'It will be implemented soon',
        },
    });
})}

但是在组件catch块中不起作用:

onAddUser(data) {
    const { userActions: { create } = {} } = this.props;

    create(data)
        .then(() => {})
        .catch(err => console.error(err)) // not working

0 个答案:

没有答案