import { useI18n } from 'vue-i18n' import { useToastController } from 'bootstrap-vue-next' export function useAppToast() { const { t } = useI18n() const { show } = useToastController() const toastSuccess = (message) => { toast(message, { title: t('success'), variant: 'success', }) } const toastError = (message) => { toast(message, { title: t('error'), variant: 'danger', }) } const toast = (message, options = {}) => { if (message.replace) message = message.replace(/^GraphQL error: /, '') options = { solid: true, toaster: 'b-toaster-top-right', headerClass: 'gdd-toaster-title', bodyClass: 'gdd-toaster-body', toastClass: 'gdd-toaster', ...options, body: message, } show({ props: { ...options } }) } return { toastSuccess, toastError, toast, } }