catch(error =>) {

  console.log(error)

}

 

로 찍으면

 

 

Error: Request failed with status code 422
    at createError (app.js:6765)
    at settle (app.js:29489)
    at XMLHttpRequest.handleLoad (app.js:6600)

 

단순 string만 반환하는데

 

return 된 object를 받고 싶으면

 

 

axios.post('/formulas/create', {
	name: "",
	parts: ""
})
.then(response => { 
	console.log(response)
})
.catch(error => {
    console.log(error.response)
});

 

 

 

console.log(error.response) 로 받으면 된다

 

 

출처 : https://github.com/axios/axios/issues/960

'frontend' 카테고리의 다른 글

[Vue] bootstrap-vue dropdown select event  (0) 2019.05.08

+ Recent posts