diff --git a/ui/src/stores/modules/application.ts b/ui/src/stores/modules/application.ts index 288d7eba0..9692ab817 100644 --- a/ui/src/stores/modules/application.ts +++ b/ui/src/stores/modules/application.ts @@ -2,25 +2,12 @@ import { defineStore } from 'pinia' import applicationApi from '@/api/application/application' import applicationXpackApi from '@/api/application/application-xpack' import { type Ref } from 'vue' -import { getBrowserLang } from '@/locales/index' import useUserStore from './user' const useApplicationStore = defineStore('application', { state: () => ({ location: `${window.location.origin}${window.MaxKB.chatPrefix}/`, }), actions: { - async asyncGetAllApplication() { - return new Promise((resolve, reject) => { - // applicationApi - // .getAllAppilcation() - // .then((data) => { - // resolve(data) - // }) - // .catch((error) => { - // reject(error) - // }) - }) - }, async asyncGetApplicationDetail(id: string, loading?: Ref) { return new Promise((resolve, reject) => { @@ -60,21 +47,6 @@ const useApplicationStore = defineStore('application', { }) }, - async asyncGetAppProfile(loading?: Ref) { - return new Promise((resolve, reject) => { - console.log('xxxx') - applicationApi - .getAppProfile(loading) - .then((res: any) => { - sessionStorage.setItem('language', res.data?.language || getBrowserLang()) - resolve(res) - }) - .catch((error: any) => { - reject(error) - }) - }) - }, - async asyncAppAuthentication( token: string, loading?: Ref, @@ -109,18 +81,6 @@ const useApplicationStore = defineStore('application', { }) }) }, - async validatePassword(id: string, password: string, loading?: Ref) { - return new Promise((resolve, reject) => { - // applicationApi - // .validatePassword(id, password, loading) - // .then((data) => { - // resolve(data) - // }) - // .catch((error) => { - // reject(error) - // }) - }) - }, }, }) diff --git a/ui/src/stores/modules/chat-user.ts b/ui/src/stores/modules/chat-user.ts index 4bd0375d3..b92fe2de6 100644 --- a/ui/src/stores/modules/chat-user.ts +++ b/ui/src/stores/modules/chat-user.ts @@ -3,6 +3,9 @@ import ChatAPI from '@/api/chat/chat' import type { ChatProfile, ChatUserProfile } from '@/api/type/chat' import type { LoginRequest } from '@/api/type/user' import type { Ref } from 'vue' +import { useLocalStorage } from '@vueuse/core' +import { localeConfigKey } from '@/locales/index' +import useUserStore from './user' interface ChatUser { // 用户id id: string @@ -38,6 +41,9 @@ const useChatUserStore = defineStore('chat-user', { applicationProfile() { return ChatAPI.applicationProfile().then((ok) => { this.application = ok.data + const user = useUserStore() + useLocalStorage(localeConfigKey, 'en-US').value = + ok?.data?.language || user.getLanguage() if (this.application.custom_theme) { this.application['custom_theme']['theme_color'] = ok.data?.custom_theme?.theme_color || '#3370FF' diff --git a/ui/src/stores/modules/theme.ts b/ui/src/stores/modules/theme.ts index d66307a8b..f118efab0 100644 --- a/ui/src/stores/modules/theme.ts +++ b/ui/src/stores/modules/theme.ts @@ -26,11 +26,6 @@ const useThemeStore = defineStore('theme', { async theme(loading?: Ref) { return await ThemeApi.getThemeInfo(loading).then((ok) => { this.setTheme(ok.data) - // window.document.title = this.themeInfo['title'] || 'MaxKB' - // const link = document.querySelector('link[rel="icon"]') as any - // if (link) { - // link['href'] = this.themeInfo['icon'] || '/favicon.ico' - // } }) }, }, diff --git a/ui/src/stores/modules/user.ts b/ui/src/stores/modules/user.ts index 31e0896ce..50d789b72 100644 --- a/ui/src/stores/modules/user.ts +++ b/ui/src/stores/modules/user.ts @@ -99,12 +99,6 @@ const useUserStore = defineStore('user', { getEditionName() { return this.edition }, - changeUserType(num: number, token?: string) { - this.userType = num - const login = useLoginStore() - login.userAccessToken = token || '' - }, - async profile(loading?: Ref) { return UserApi.getUserProfile(loading).then((ok) => { this.userInfo = ok.data