2017-08-15 59 views
1

我遇到了一个问题,即我的node.js服务器正在向浏览器返回一个422消息,但浏览器只是看到422而没有任何消息。422不返回发送消息(Node.js/Redux)

//Node.js 
if (existingUser) { 
return res.status(422).send({ error: 'Email is in use' }); 
} 

我可以证实它是打那里,在这一点上返回

//Redux method 
export function signupUser({ email, password }) { 
return function(dispatch) { 
    return axios.post(`${ROOT_URL}/signup`, { email, password }) 
    .then(response => { 
    dispatch(emailWasSent(response.data.return_msg)); 
    }) 
    .catch(response => { 
    dispatch(authError(response.data.error));}); 
    } 
} 

它将击中追赶,但响应只包含422

//Console.log of response 
Error: Request failed with status code 422 
+0

你能告诉我们在做日志的代码吗? –

+0

执行日志记录的代码是redux catch部分 – Mike

回答

0

四处寻找了一天之后我发现这是一个axios问题。他们改变了他们的catch案。它现在应该是

error.response.data.error