23 lines
492 B
TypeScript
23 lines
492 B
TypeScript
import { useQuasar } from 'quasar'
|
|
import { useI18n } from 'vue-i18n'
|
|
import type { ServerError } from 'boot/axios'
|
|
|
|
export type { ServerError }
|
|
|
|
export function useNotify() {
|
|
const $q = useQuasar()
|
|
const { t } = useI18n()
|
|
|
|
const notifyError = (error: ServerError) => {
|
|
$q.notify({
|
|
message: `${t(error.message)} (${t('code')}: ${error.code})`,
|
|
type: 'negative',
|
|
position: 'bottom',
|
|
timeout: 1000,
|
|
multiLine: true
|
|
})
|
|
}
|
|
|
|
return { notifyError }
|
|
}
|