v6
This commit is contained in:
22
src/composables/useNotify.ts
Normal file
22
src/composables/useNotify.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
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: 2000,
|
||||
multiLine: true
|
||||
})
|
||||
}
|
||||
|
||||
return { notifyError}
|
||||
}
|
||||
Reference in New Issue
Block a user