summaryrefslogtreecommitdiff
path: root/src/components/Mixins/BVToastMixin.js
blob: 4fedc9a46ae7b1bd448f5dccbe8107bec5a1dafa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import i18n from '../../i18n';

const BVToastMixin = {
  methods: {
    successToast(message, title = i18n.t('global.status.success')) {
      this.$root.$bvToast.toast(message, {
        title,
        variant: 'success',
        autoHideDelay: 10000, //auto hide in milliseconds
        isStatus: true,
        solid: true
      });
    },
    errorToast(message, title = i18n.t('global.status.error')) {
      this.$root.$bvToast.toast(message, {
        title,
        variant: 'danger',
        noAutoHide: true,
        isStatus: true,
        solid: true
      });
    },
    warningToast(message, title = i18n.t('global.status.warning')) {
      this.$root.$bvToast.toast(message, {
        title,
        variant: 'warning',
        noAutoHide: true,
        isStatus: true,
        solid: true
      });
    }
  }
};

export default BVToastMixin;