mirror of
https://github.com/Wei-Shaw/claude-relay-service.git
synced 2026-01-23 20:10:39 +00:00
feat: Element Plus 语言随 i18n 切换;用户侧登录/禁用提示接入 i18n
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { defineStore } from 'pinia'
|
||||
import axios from 'axios'
|
||||
import i18n from '@/i18n'
|
||||
import { showToast } from '@/utils/toast'
|
||||
|
||||
const API_BASE = '/users'
|
||||
@@ -40,7 +41,7 @@ export const useUserStore = defineStore('user', {
|
||||
|
||||
return response.data
|
||||
} else {
|
||||
throw new Error(response.data.message || 'Login failed')
|
||||
throw new Error(response.data.message || i18n.global.t('user.login.loginFailed'))
|
||||
}
|
||||
} catch (error) {
|
||||
this.clearAuth()
|
||||
@@ -115,7 +116,9 @@ export const useUserStore = defineStore('user', {
|
||||
this.clearAuth()
|
||||
// If it's a disabled account error, throw a specific error
|
||||
if (error.response?.status === 403) {
|
||||
throw new Error(error.response.data?.message || 'Your account has been disabled')
|
||||
throw new Error(
|
||||
error.response.data?.message || i18n.global.t('user.login.accountDisabled')
|
||||
)
|
||||
}
|
||||
}
|
||||
throw error
|
||||
|
||||
Reference in New Issue
Block a user