import { isPlainObject } from 'is-what' // @ts-ignore import { createToaster } from '@meforma/vue-toaster' const toaster = createToaster() export function hideAllToasts() { return toaster.clear() } export function showToast(message: string, options?: Record): void { if (!isPlainObject(options)) { return toaster.show(message, { kind: 'default', position: 'top', duration: 2_000, class: 'text-wrap-all', }) } return toaster.show(message, { kind: 'default', position: 'top', duration: 5_000, class: 'text-wrap-all', ...options, }) } export function showToastError(error: any, customMessage = '', log = true): void { const message = customMessage || error?.message || error toaster.show(message, { kind: 'error', position: 'top', duration: 5_000, }) }