diff --git a/frontend/src/App.jsx b/frontend/src/App.jsx index 90b784c..19b0ea6 100644 --- a/frontend/src/App.jsx +++ b/frontend/src/App.jsx @@ -98,6 +98,9 @@ function App() { } }, [showUserPopover]) + // 必须在定义 effectiveUserId 之前定义 isAdmin + const isAdmin = (me?.role || '') === 'admin' + // 当前查看的用户信息 const currentViewingUser = users.find((u) => parseInt(String(u?.id || ''), 10) === viewingUserId) const effectiveUserId = isAdmin && viewingUserId ? viewingUserId : parseInt(String(me?.id || ''), 10) @@ -118,8 +121,6 @@ function App() { // eslint-disable-next-line react-hooks/exhaustive-deps }, []) - const isAdmin = (me?.role || '') === 'admin' - if (checking) { return (