pub(crate) fn switch(route: Route) -> HtmlExpand description
The main routing logic for the application.
This function takes a Route enum variant and returns the corresponding HTML
content to be rendered. It acts as a central dispatcher for the application’s
navigation and authentication flow.
Most routes are wrapped in ProtectedRoute to enforce authentication
and authorization based on the admin_page flag, and in SidebarShell to maintain consistent layout.
Login and Setup routes use AdminCheckWrapper instead to handle pre-authentication states.
§Arguments
route: TheRouteenum variant representing the current URL path.
§Returns
An Html component that should be rendered for the given route.
§Route Protection
- Admin-required routes (
admin_page={true}): Require both authentication and admin privileges - Public routes (
admin_page={false}): Require only authentication - Pre-auth routes (
AdminCheckWrapper): Used before admin creation or login