vikunja-frontend/src/message/index.js

43 lines
923 B
JavaScript
Raw Normal View History

2018-09-08 21:43:16 +02:00
export default {
2018-11-27 11:23:50 +01:00
setLoading(context) {
const timeout = setTimeout(function () {
context.loading = true
}, 100)
2018-11-27 11:23:50 +01:00
return () => {
2018-12-19 12:27:03 +01:00
clearTimeout(timeout)
context.loading = false
}
2018-11-27 11:23:50 +01:00
},
error(e, context, actions = []) {
// 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
}
2018-09-08 21:43:16 +02:00
// Fire a notification
context.$notify({
type: 'error',
title: 'Error',
text: err,
actions: actions,
})
},
success(e, context, actions = []) {
// 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
}
2018-09-09 21:28:07 +02:00
// Fire a notification
context.$notify({
type: 'success',
title: 'Success',
text: err,
data: {
actions: actions,
},
})
},
2018-09-08 21:43:16 +02:00
}