2017-08-15 149 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