useCanAccessAdminPanel
useCanAccessAdminPanel():
boolean
Defined in: packages/react/src/hooks/useCanAccessAdminPanel.ts:25
Whether the signed-in user may reach the admin panel.
Evaluates the same predicate the server route uses
(canAccessAdminPanel), so an “Admin” affordance in site chrome cannot
disagree with what happens on navigation — the alternative, reading a role
off the session by hand, silently breaks whenever access.userRolesField
is anything other than what the caller guessed.
Advisory only, like usePermission: the server route still redirects an
unauthorized caller. This exists so the UI does not offer a link that leads
to /unauthorized.
Returns
Section titled “Returns”boolean
true when the current user passes the admin-panel check;
false when signed out, when no access config is in context, or when
denied.