This commit is contained in:
Baobhan Sith
2025-04-19 10:38:37 +08:00
parent 241eb7a812
commit 2ca4b957e6
2 changed files with 57 additions and 37 deletions
@@ -7,7 +7,7 @@ import type { AppearanceSettings, UpdateAppearanceDto } from '../../../backend/s
import { defaultXtermTheme, defaultUiTheme } from './default-themes.js'; // 尝试添加 .js (编译后) 或保持 .ts
// Helper function to safely parse JSON
const safeJsonParse = <T>(jsonString: string | undefined | null, defaultValue: T): T => {
export const safeJsonParse = <T>(jsonString: string | undefined | null, defaultValue: T): T => { // Add export
if (!jsonString) return defaultValue;
try {
return JSON.parse(jsonString);