Added better notification handling
This commit is contained in:
parent
875e4ea6e6
commit
85a8296278
5 changed files with 32 additions and 27 deletions
16
src/message/index.js
Normal file
16
src/message/index.js
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
export default {
|
||||
error(e, context) {
|
||||
// Build the notification text from error response
|
||||
let err = e.message
|
||||
if (e.response && e.response.data && e.response.data.message) {
|
||||
err += '<br/>' + e.response.data.message
|
||||
}
|
||||
|
||||
// Fire a notification
|
||||
context.$notify({
|
||||
type: 'error',
|
||||
title: 'Error',
|
||||
text: err
|
||||
})
|
||||
}
|
||||
}
|
||||
Reference in a new issue