fix(ui): dashboard 加 loadSettings, CORS banner 终于不假阳性了
Bug FE-002:
- /admin dashboard 顶部黄条"跨域 CORS 未配置"永远显示
- 原因: reloadAll() 没调 loadSettings, dashboard 上 settings.value 一直是 {}
- banner 判断 `!settings.cors_configured` → undefined → falsy → 触发
- 只有手动进 settings tab 触发 loadSettings() 后才消失
- 刷新页面又出现(被用户当成"CORS 没生效")
修法: 一行。reloadAll() 加上 loadSettings(), mount 时一并加载,
dashboard 上 settings 就有真值了, banner 判断正确。
diff:
- const reloadAll = () => { loadOverview(); loadVoices(); };
+ const reloadAll = () => { loadOverview(); loadVoices(); loadSettings(); };
副作用: 无。 loadSettings 自带 try/catch, 即使 /api/settings 失败
也不影响 overview/voices 加载。 watch(tab) 仍会再调一次
loadSettings (idempotent, 覆盖 fresh 值)。
验证 (本机 + 你的报告复现):
- 强刷 admin → mount 时 3 个 API 并行加载
- settings.value 填好, cors_configured = true
- banner `v-if="settings && !settings.cors_configured && ..."` 评估为 false → 不显示
未 push(等你确认)
二进制: ~18MB → ~18MB (HTML 嵌入尺寸不变)
This commit is contained in:
+1
-1
@@ -953,7 +953,7 @@
|
|||||||
toast('err', '保存 CORS 失败: ' + corsErr.value);
|
toast('err', '保存 CORS 失败: ' + corsErr.value);
|
||||||
} finally { savingCors.value = false; }
|
} finally { savingCors.value = false; }
|
||||||
};
|
};
|
||||||
const reloadAll = () => { loadOverview(); loadVoices(); };
|
const reloadAll = () => { loadOverview(); loadVoices(); loadSettings(); };
|
||||||
|
|
||||||
const saveSettings = async () => {
|
const saveSettings = async () => {
|
||||||
settingsErr.value = '';
|
settingsErr.value = '';
|
||||||
|
|||||||
Reference in New Issue
Block a user