a
This commit is contained in:
parent
fac2651911
commit
7d3d9c7de1
|
|
@ -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>
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user