Yoshie Muranaka | 183c275 | 2020-02-12 11:30:49 -0800 | [diff] [blame] | 1 | import i18n from '../../i18n'; |
| 2 | |
Yoshie Muranaka | 0fc91e7 | 2020-02-05 11:23:06 -0800 | [diff] [blame] | 3 | const BVToastMixin = { |
| 4 | methods: { |
Yoshie Muranaka | 547b5fc | 2020-02-24 15:42:40 -0800 | [diff] [blame] | 5 | successToast(message, title = i18n.t('global.status.success')) { |
Yoshie Muranaka | 0fc91e7 | 2020-02-05 11:23:06 -0800 | [diff] [blame] | 6 | this.$root.$bvToast.toast(message, { |
Yoshie Muranaka | 183c275 | 2020-02-12 11:30:49 -0800 | [diff] [blame] | 7 | title, |
Yoshie Muranaka | 0fc91e7 | 2020-02-05 11:23:06 -0800 | [diff] [blame] | 8 | variant: 'success', |
| 9 | autoHideDelay: 10000, //auto hide in milliseconds |
| 10 | isStatus: true, |
| 11 | solid: true |
| 12 | }); |
| 13 | }, |
Yoshie Muranaka | 547b5fc | 2020-02-24 15:42:40 -0800 | [diff] [blame] | 14 | errorToast(message, title = i18n.t('global.status.error')) { |
Yoshie Muranaka | 0fc91e7 | 2020-02-05 11:23:06 -0800 | [diff] [blame] | 15 | this.$root.$bvToast.toast(message, { |
Yoshie Muranaka | 183c275 | 2020-02-12 11:30:49 -0800 | [diff] [blame] | 16 | title, |
Yoshie Muranaka | 0fc91e7 | 2020-02-05 11:23:06 -0800 | [diff] [blame] | 17 | variant: 'danger', |
| 18 | noAutoHide: true, |
| 19 | isStatus: true, |
| 20 | solid: true |
| 21 | }); |
Yoshie Muranaka | 183c275 | 2020-02-12 11:30:49 -0800 | [diff] [blame] | 22 | }, |
Yoshie Muranaka | 547b5fc | 2020-02-24 15:42:40 -0800 | [diff] [blame] | 23 | warningToast(message, title = i18n.t('global.status.warning')) { |
Yoshie Muranaka | 183c275 | 2020-02-12 11:30:49 -0800 | [diff] [blame] | 24 | this.$root.$bvToast.toast(message, { |
| 25 | title, |
| 26 | variant: 'warning', |
| 27 | noAutoHide: true, |
| 28 | isStatus: true, |
| 29 | solid: true |
| 30 | }); |
Derick Montague | 4e90eed | 2020-03-03 18:11:44 -0600 | [diff] [blame^] | 31 | }, |
| 32 | infoToast(message, title = i18n.t('global.status.informational')) { |
| 33 | this.$root.$bvToast.toast(message, { |
| 34 | title, |
| 35 | variant: 'info', |
| 36 | noAutoHide: true, |
| 37 | isStatus: true, |
| 38 | solid: true |
| 39 | }); |
Yoshie Muranaka | 0fc91e7 | 2020-02-05 11:23:06 -0800 | [diff] [blame] | 40 | } |
| 41 | } |
| 42 | }; |
| 43 | |
| 44 | export default BVToastMixin; |