feat: use vue-i18n 9 for vue3
This commit is contained in:
@ -1,11 +1,11 @@
|
||||
import {i18n} from '@/i18n/setup'
|
||||
import {i18n} from '@/i18n'
|
||||
|
||||
export const getErrorText = (r) => {
|
||||
|
||||
if (r.response && r.response.data) {
|
||||
if(r.response.data.code) {
|
||||
const path = `error.${r.response.data.code}`
|
||||
const message = i18n.t(path)
|
||||
const message = i18n.global.t(path)
|
||||
|
||||
// If message and path are equal no translation exists for that error code
|
||||
if (path !== message) {
|
||||
@ -30,7 +30,7 @@ export const getErrorText = (r) => {
|
||||
export function error(e, context, actions = []) {
|
||||
context.$notify({
|
||||
type: 'error',
|
||||
title: i18n.t('error.error'),
|
||||
title: i18n.global.t('error.error'),
|
||||
text: getErrorText(e),
|
||||
actions: actions,
|
||||
})
|
||||
@ -40,7 +40,7 @@ export function error(e, context, actions = []) {
|
||||
export function success(e, context, actions = []) {
|
||||
context.$notify({
|
||||
type: 'success',
|
||||
title: i18n.t('error.success'),
|
||||
title: i18n.global.t('error.success'),
|
||||
text: getErrorText(e),
|
||||
data: {
|
||||
actions: actions,
|
||||
|
Reference in New Issue
Block a user