blob: a46f5e50bc512170a0eabddb7aac9c13fed7f198 [file] [log] [blame]
Yoshie Muranaka183c2752020-02-12 11:30:49 -08001import i18n from '../../i18n';
2
Yoshie Muranaka0fc91e72020-02-05 11:23:06 -08003const BVToastMixin = {
4 methods: {
Yoshie Muranaka183c2752020-02-12 11:30:49 -08005 successToast(message, title = i18n.t('global.response.success')) {
Yoshie Muranaka0fc91e72020-02-05 11:23:06 -08006 this.$root.$bvToast.toast(message, {
Yoshie Muranaka183c2752020-02-12 11:30:49 -08007 title,
Yoshie Muranaka0fc91e72020-02-05 11:23:06 -08008 variant: 'success',
9 autoHideDelay: 10000, //auto hide in milliseconds
10 isStatus: true,
11 solid: true
12 });
13 },
Yoshie Muranaka183c2752020-02-12 11:30:49 -080014 errorToast(message, title = i18n.t('global.response.error')) {
Yoshie Muranaka0fc91e72020-02-05 11:23:06 -080015 this.$root.$bvToast.toast(message, {
Yoshie Muranaka183c2752020-02-12 11:30:49 -080016 title,
Yoshie Muranaka0fc91e72020-02-05 11:23:06 -080017 variant: 'danger',
18 noAutoHide: true,
19 isStatus: true,
20 solid: true
21 });
Yoshie Muranaka183c2752020-02-12 11:30:49 -080022 },
23 warningToast(message, title = i18n.t('global.response.warning')) {
24 this.$root.$bvToast.toast(message, {
25 title,
26 variant: 'warning',
27 noAutoHide: true,
28 isStatus: true,
29 solid: true
30 });
Yoshie Muranaka0fc91e72020-02-05 11:23:06 -080031 }
32 }
33};
34
35export default BVToastMixin;