Skip to content

isopruefi-frontend v1.0.0


isopruefi-frontend / components/ProtectedRoute / default

Function: default()

default(props): Element

Defined in: components/ProtectedRoute.tsx:15

ProtectedRoute component for role-based route protection.
Checks authentication and user role before rendering child routes.
- If authentication is not ready, shows a loading indicator.
- If user is not authenticated, redirects to the public welcome page.
- If user role is not allowed, redirects to their default page.

Parameters

props

Component props.

allowed

("admin" | "user")[]

Array of allowed roles for the route.

Returns

Element

The rendered protected route or a redirect.