This repository has been archived on 2024-02-08. You can view files and clone it, but cannot push or open issues or pull requests.
frontend/src/message/index.js
konrad f7d8095b5a
All checks were successful
continuous-integration/drone/push Build is passing
Pagingation for tasks in kanban buckets (#419)
Co-authored-by: kolaente <k@knt.li>
Reviewed-on: #419
Co-authored-by: konrad <konrad@kola-entertainments.de>
Co-committed-by: konrad <konrad@kola-entertainments.de>
2021-03-10 10:59:29 +00:00

43 lines
923 B
JavaScript

export default {
setLoading(context) {
const timeout = setTimeout(function () {
context.loading = true
}, 100)
return () => {
clearTimeout(timeout)
context.loading = false
}
},
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
}
// 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
}
// Fire a notification
context.$notify({
type: 'success',
title: 'Success',
text: err,
data: {
actions: actions,
},
})
},
}