@@ -6,7 +6,6 @@ import UserApi from '@/api/user'
66import ThemeApi from '@/api/theme'
77import { useElementPlusTheme } from 'use-element-plus-theme'
88import { defaultPlatformSetting } from '@/utils/theme'
9- import useApplicationStore from './application'
109import { useLocalStorage } from '@vueuse/core'
1110import { localeConfigKey } from '@/locales/index'
1211export interface userStateTypes {
@@ -33,10 +32,9 @@ const useUserStore = defineStore({
3332 } ) ,
3433 actions : {
3534 getLanguage ( ) {
36- const application = useApplicationStore ( )
3735 return this . userType === 1
38- ? this . userInfo ?. language || localStorage . getItem ( 'language ' )
39- : application ?. userLanguage
36+ ? localStorage . getItem ( 'MaxKB-locale ' )
37+ : sessionStorage . getItem ( 'language' )
4038 } ,
4139 showXpack ( ) {
4240 return this . isXPack
@@ -127,7 +125,6 @@ const useUserStore = defineStore({
127125 return UserApi . profile ( ) . then ( async ( ok ) => {
128126 this . userInfo = ok . data
129127 useLocalStorage ( localeConfigKey , 'zh-CN' ) . value = ok . data ?. language
130- // localStorage.setItem('language', ok.data?.language)
131128 return this . asyncGetProfile ( )
132129 } )
133130 } ,
@@ -174,8 +171,8 @@ const useUserStore = defineStore({
174171 return new Promise ( ( resolve , reject ) => {
175172 UserApi . postLanguage ( { language : lang } , loading )
176173 . then ( async ( ok ) => {
174+ useLocalStorage ( localeConfigKey , 'zh-CN' ) . value = lang
177175 window . location . reload ( )
178-
179176 resolve ( ok )
180177 } )
181178 . catch ( ( error ) => {
0 commit comments