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