feat(frontend): add debugMode global variable to store debug mode state

This commit is contained in:
2026-09-10 19:36:29 +08:00
parent d96b90b5bf
commit 78284ed816
3 changed files with 33 additions and 0 deletions
+22
View File
@@ -0,0 +1,22 @@
import { ref } from 'vue';
import { settingsApi } from '../api/index.js';
// Runtime flags mirrored from the backend config so any view can read them
// without refetching the whole config.
// debugMode mirrors system.debugMode from the global config (config.json).
export const debugMode = ref(false);
// loadDebugMode reads the global config and mirrors system.debugMode into the
// `debugMode` global. The endpoint needs an admin session, so callers only
// invoke it once logged in; a failed request keeps the current value.
export async function loadDebugMode() {
try {
const res = await settingsApi.get('global');
const config = (res && res.data && res.data.config) || {};
const system = config.system || {};
debugMode.value = !!system.debugMode;
} catch {
// Non-fatal: the flag simply keeps its current value.
}
}