This commit is contained in:
薇薇安 2026-01-22 11:50:32 +08:00
parent fac2651911
commit 7d3d9c7de1

View File

@ -206,6 +206,8 @@ const GlobalConfig = ({ currentUser }) => {
const m = await api.getConfigMeta()
setConfigMeta(m || null)
} catch (e) {
//
console.error('loadConfigMeta failed:', e)
setConfigMeta(null)
}
}
@ -281,15 +283,16 @@ const GlobalConfig = ({ currentUser }) => {
useEffect(() => {
loadUsers()
loadAccounts()
//
if (isAdmin) {
loadConfigMeta()
loadConfigs()
loadSystemStatus()
loadBackendStatus()
loadConfigMeta().catch(() => {}) //
loadConfigs().catch(() => {}) //
loadSystemStatus().catch(() => {}) //
loadBackendStatus().catch(() => {}) //
const timer = setInterval(() => {
loadSystemStatus()
loadBackendStatus()
loadSystemStatus().catch(() => {})
loadBackendStatus().catch(() => {})
}, 3000)
return () => clearInterval(timer)
}
@ -681,6 +684,9 @@ const GlobalConfig = ({ currentUser }) => {
}
}
// 使 isAdmin
const isAdmin = (currentUser?.role || '') === 'admin'
if (loading) {
return <div className="global-config">加载中...</div>
}