vikunja-frontend/src/message/index.js

32 lines
500 B
JavaScript
Raw Normal View History

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 {
error(e, context, actions = []) {
context.$notify({
type: 'error',
title: 'Error',
text: getText(e),
actions: actions,
})
},
success(e, context, actions = []) {
context.$notify({
type: 'success',
title: 'Success',
text: getText(e),
data: {
actions: actions,
},
})
},
2018-09-08 21:43:16 +02:00
}