fix: 修复logout清除新主题偏好; 移除DesktopLayout未使用的themeLabels导入

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2026-07-13 01:51:17 +08:00
parent e14308b757
commit 5b55029576
2 changed files with 8 additions and 4 deletions
+1 -1
View File
@@ -2,7 +2,7 @@
import { useRoute, useRouter } from 'vue-router'
import { computed, ref } from 'vue'
import { useAuthStore } from '@/stores/auth'
import { useThemeStore, themeLabels } from '@/stores/theme'
import { useThemeStore } from '@/stores/theme'
const route = useRoute()
const router = useRouter()
+7 -3
View File
@@ -29,10 +29,14 @@ export const useAuthStore = defineStore('auth', () => {
userId.value = ''
name.value = ''
role.value = ''
// Preserve theme preference across logout
const savedTheme = localStorage.getItem('theme')
// Preserve theme preferences across logout
const savedMode = localStorage.getItem('theme-mode')
const savedLight = localStorage.getItem('theme-light')
const savedDark = localStorage.getItem('theme-dark')
localStorage.clear()
if (savedTheme) localStorage.setItem('theme', savedTheme)
if (savedMode) localStorage.setItem('theme-mode', savedMode)
if (savedLight) localStorage.setItem('theme-light', savedLight)
if (savedDark) localStorage.setItem('theme-dark', savedDark)
}
async function casdoorLogin(code: string, state: string) {