This commit is contained in:
薇薇安 2026-01-22 11:44:03 +08:00
parent 3ef66fb54a
commit fac2651911

View File

@ -98,6 +98,9 @@ function App() {
} }
}, [showUserPopover]) }, [showUserPopover])
// effectiveUserId isAdmin
const isAdmin = (me?.role || '') === 'admin'
// //
const currentViewingUser = users.find((u) => parseInt(String(u?.id || ''), 10) === viewingUserId) const currentViewingUser = users.find((u) => parseInt(String(u?.id || ''), 10) === viewingUserId)
const effectiveUserId = isAdmin && viewingUserId ? viewingUserId : parseInt(String(me?.id || ''), 10) const effectiveUserId = isAdmin && viewingUserId ? viewingUserId : parseInt(String(me?.id || ''), 10)
@ -118,8 +121,6 @@ function App() {
// eslint-disable-next-line react-hooks/exhaustive-deps // eslint-disable-next-line react-hooks/exhaustive-deps
}, []) }, [])
const isAdmin = (me?.role || '') === 'admin'
if (checking) { if (checking) {
return ( return (
<div className="app"> <div className="app">