mirror of
https://github.com/shuaiplus/nodewarden.git
synced 2026-06-20 13:00:39 +00:00
fix: improve lock timeout retrieval by handling null and empty values
This commit is contained in:
+3
-1
@@ -146,7 +146,9 @@ function resolveSystemTheme(): 'light' | 'dark' {
|
||||
|
||||
function readLockTimeoutMinutes(): LockTimeoutMinutes {
|
||||
if (typeof window === 'undefined') return 15;
|
||||
const value = Number(window.localStorage.getItem(LOCK_TIMEOUT_STORAGE_KEY));
|
||||
const stored = window.localStorage.getItem(LOCK_TIMEOUT_STORAGE_KEY);
|
||||
if (stored === null || stored.trim() === '') return 15;
|
||||
const value = Number(stored);
|
||||
return LOCK_TIMEOUT_VALUES.has(value as LockTimeoutMinutes) ? (value as LockTimeoutMinutes) : 15;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user