@@ -20,7 +20,6 @@ export interface userStateTypes {
2020 version ?: string
2121 license_is_valid : boolean
2222 edition : 'CE' | 'PE' | 'EE'
23- themeInfo : any
2423 workspace_id : string
2524 workspace_list : Array < any >
2625}
@@ -32,7 +31,6 @@ const useUserStore = defineStore('user', {
3231 version : '' ,
3332 license_is_valid : false ,
3433 edition : 'CE' ,
35- themeInfo : null ,
3634 workspace_id : '' ,
3735 workspace_list : [ ] ,
3836 } ) ,
@@ -42,14 +40,7 @@ const useUserStore = defineStore('user', {
4240 ? localStorage . getItem ( 'MaxKB-locale' ) || getBrowserLang ( )
4341 : sessionStorage . getItem ( 'language' ) || getBrowserLang ( )
4442 } ,
45- isDefaultTheme ( ) {
46- return ! this . themeInfo ?. theme || this . themeInfo ?. theme === '#3370FF'
47- } ,
48- setTheme ( data : any ) {
49- const { changeTheme } = useElementPlusTheme ( this . themeInfo ?. theme )
50- changeTheme ( data ?. [ 'theme' ] )
51- this . themeInfo = cloneDeep ( data )
52- } ,
43+
5344 setWorkspaceId ( workspace_id : string ) {
5445 this . workspace_id = workspace_id
5546 localStorage . setItem ( 'workspace_id' , workspace_id )
@@ -114,16 +105,7 @@ const useUserStore = defineStore('user', {
114105 const login = useLoginStore ( )
115106 login . userAccessToken = token || ''
116107 } ,
117- async theme ( loading ?: Ref < boolean > ) {
118- return await ThemeApi . getThemeInfo ( loading ) . then ( ( ok ) => {
119- this . setTheme ( ok . data )
120- // window.document.title = this.themeInfo['title'] || 'MaxKB'
121- // const link = document.querySelector('link[rel="icon"]') as any
122- // if (link) {
123- // link['href'] = this.themeInfo['icon'] || '/favicon.ico'
124- // }
125- } )
126- } ,
108+
127109 async profile ( loading ?: Ref < boolean > ) {
128110 return UserApi . getUserProfile ( loading ) . then ( ( ok ) => {
129111 this . userInfo = ok . data
@@ -151,11 +133,11 @@ const useUserStore = defineStore('user', {
151133 // this.version = ok.data?.version || '-'
152134 this . license_is_valid = ok . data . license_is_valid
153135 this . edition = ok . data . edition
154-
136+ const theme = useThemeStore ( )
155137 if ( this . isEE ( ) || this . isPE ( ) ) {
156- await this . theme ( )
138+ await theme . theme ( )
157139 } else {
158- this . themeInfo = {
140+ theme . themeInfo = {
159141 ...defaultPlatformSetting ,
160142 }
161143 }
0 commit comments