fix: apply theme preference on login page

- Login component now applies saved theme preference on mount
- Theme preference correctly persists across logout/login in all modes
- Fixes issue where login page would revert to default theme after logout
This commit is contained in:
Pulse Monitor
2025-08-17 07:00:15 +00:00
parent c849a2b358
commit 90e961bc5e
+9
View File
@@ -1,5 +1,6 @@
import { Component, createSignal, Show, onMount, lazy, Suspense } from 'solid-js';
import { setBasicAuth } from '@/utils/apiClient';
import { STORAGE_KEYS } from '@/constants';
// Force include FirstRunSetup with lazy loading
const FirstRunSetup = lazy(() => import('./FirstRunSetup').then(m => ({ default: m.FirstRunSetup })));
@@ -17,6 +18,14 @@ export const Login: Component<LoginProps> = (props) => {
const [loadingAuth, setLoadingAuth] = createSignal(true);
onMount(async () => {
// Apply saved theme preference
const savedTheme = localStorage.getItem(STORAGE_KEYS.DARK_MODE);
if (savedTheme === 'true') {
document.documentElement.classList.add('dark');
} else {
document.documentElement.classList.remove('dark');
}
console.log('[Login] Starting auth check...');
try {
const response = await fetch('/api/security/status');