Report errors from requests with the error json property

This commit is contained in:
Ekaterina Vaartis 2019-09-24 09:37:01 +03:00
parent 47e60b11a7
commit acfdb3ae6f

View file

@ -11,8 +11,13 @@ service.interceptors.response.use(
response => response,
error => {
console.log('Error ' + error)
console.log(error.response.data)
// If there's an "error" property in the json, use it
const edata = error.response.data.error ? error.response.data.error : error.response.data
Message({
message: `${error.message} - ${error.response.data}`,
message: `${error.message} - ${edata}`,
type: 'error',
duration: 5 * 1000
})