From fac2651911da88814f35e58d42d553cdb25865f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=96=87=E8=96=87=E5=AE=89?= Date: Thu, 22 Jan 2026 11:44:03 +0800 Subject: [PATCH] a --- frontend/src/App.jsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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 (