mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
global mixin for toasting error and success
This commit is contained in:
parent
ce457ffc0c
commit
df63d76a86
@ -3,6 +3,7 @@ import DashboardPlugin from './plugins/dashboard-plugin'
|
|||||||
import App from './App.vue'
|
import App from './App.vue'
|
||||||
import i18n from './i18n.js'
|
import i18n from './i18n.js'
|
||||||
import { loadAllRules } from './validation-rules'
|
import { loadAllRules } from './validation-rules'
|
||||||
|
import { toasters } from './mixins/toaster'
|
||||||
|
|
||||||
import 'regenerator-runtime'
|
import 'regenerator-runtime'
|
||||||
|
|
||||||
@ -18,6 +19,8 @@ import { apolloProvider } from './plugins/apolloProvider'
|
|||||||
Vue.use(DashboardPlugin)
|
Vue.use(DashboardPlugin)
|
||||||
Vue.config.productionTip = false
|
Vue.config.productionTip = false
|
||||||
|
|
||||||
|
Vue.mixin(toasters)
|
||||||
|
|
||||||
Vue.toasted.register(
|
Vue.toasted.register(
|
||||||
'error',
|
'error',
|
||||||
(payload) => {
|
(payload) => {
|
||||||
|
|||||||
24
frontend/src/mixins/toaster.js
Normal file
24
frontend/src/mixins/toaster.js
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
export const toasters = {
|
||||||
|
methods: {
|
||||||
|
toastSuccess(message) {
|
||||||
|
this.toast(message, {
|
||||||
|
title: this.$t('success'),
|
||||||
|
variant: 'danger',
|
||||||
|
})
|
||||||
|
},
|
||||||
|
toastError(message) {
|
||||||
|
this.toast(message, {
|
||||||
|
title: this.$t('error.error'),
|
||||||
|
variant: 'success',
|
||||||
|
})
|
||||||
|
},
|
||||||
|
toast(message, options) {
|
||||||
|
this.$bvToast.toast(message, {
|
||||||
|
autoHideDelay: 5000,
|
||||||
|
appendToast: false,
|
||||||
|
solid: true,
|
||||||
|
...options,
|
||||||
|
})
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user