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
kolaente 6112691df8
All checks were successful
the build was successful
Added showing the loading indicator after 100ms
2018-11-27 11:19:08 +01:00

43 lines
1.0 KiB
JavaScript

export default {
setLoading(context) {
const timeout = setTimeout(function () {
context.loading = true
}, 100);
return () => {
clearTimeout(timeout);
};
},
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
})
context.loading = false
},
success(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: 'success',
title: 'Success',
text: err
})
context.loading = false
},
}