Skip to content

Commit e7b9d0f

Browse files
committed
fix: add translation
1 parent 14a2738 commit e7b9d0f

File tree

4 files changed

+9
-5
lines changed

4 files changed

+9
-5
lines changed

app/utils/api.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ export const $api = $fetch.create({
1414
options.headers.set('Csrf-Token', authStore.crsfToken)
1515
},
1616
async onResponseError(error) {
17+
const { t } = useI18n()
18+
1719
const isRequestFromExternalUrl = !String(error.response.url).startsWith(String(useRuntimeConfig().public.appBaseUrl))
1820
switch (error.response?.status) {
1921
case 401:
@@ -28,13 +30,13 @@ export const $api = $fetch.create({
2830
navigateTo({ path: '/sign-in' }, { external: true })
2931

3032
notifyError({
31-
content: 'You are not authorized to perform this action.',
33+
content: t('You are not authorized to perform this action.'),
3234
})
3335
}
3436
break
3537
default:
3638
notifyError({
37-
content: getErrorMessage(error),
39+
content: t(getErrorMessage(error)),
3840
})
3941
break
4042
}

i18n/en.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,5 +220,6 @@
220220
"days remaining": "days remaining",
221221
"You are not subscribed to any monthly plan": "You are not subscribed to any monthly plan",
222222
"View Subscriptions": "View Subscriptions",
223-
"Most popular": "Most popular"
223+
"Most popular": "Most popular",
224+
"You are not authorized to perform this action.": "You are not authorized to perform this action."
224225
}

i18n/vi.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,5 +220,6 @@
220220
"days remaining": "ngày còn lại",
221221
"You are not subscribed to any monthly plan": "Bạn chưa đăng ký gói hàng tháng nào",
222222
"View Subscriptions": "Xem các gói đăng ký",
223-
"Most popular": "Phổ biến nhất"
223+
"Most popular": "Phổ biến nhất",
224+
"You are not authorized to perform this action.": "Bạn không có quyền thực hiện hành động này."
224225
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@thecodeorigin/nuxt",
33
"type": "module",
4-
"version": "2.4.1",
4+
"version": "2.4.2",
55
"publishConfig": {
66
"registry": "https://registry.npmjs.org",
77
"access": "public"

0 commit comments

Comments
 (0)