2021-06-22 22:41:29 +02:00
|
|
|
const getText = t => {
|
|
|
|
|
|
|
|
if (t.response && t.response.data && t.response.data.message) {
|
|
|
|
return [
|
|
|
|
t.message,
|
|
|
|
t.response.data.message
|
|
|
|
]
|
|
|
|
}
|
|
|
|
|
|
|
|
return [t.message]
|
|
|
|
}
|
|
|
|
|
2018-09-08 21:43:16 +02:00
|
|
|
export default {
|
2020-03-02 21:19:26 +01:00
|
|
|
error(e, context, actions = []) {
|
|
|
|
context.$notify({
|
|
|
|
type: 'error',
|
|
|
|
title: 'Error',
|
2021-06-22 22:41:29 +02:00
|
|
|
text: getText(e),
|
2020-03-02 21:19:26 +01:00
|
|
|
actions: actions,
|
|
|
|
})
|
|
|
|
},
|
|
|
|
success(e, context, actions = []) {
|
|
|
|
context.$notify({
|
|
|
|
type: 'success',
|
|
|
|
title: 'Success',
|
2021-06-22 22:41:29 +02:00
|
|
|
text: getText(e),
|
2020-03-02 21:19:26 +01:00
|
|
|
data: {
|
|
|
|
actions: actions,
|
|
|
|
},
|
|
|
|
})
|
|
|
|
},
|
2018-09-08 21:43:16 +02:00
|
|
|
}
|