Files
RealCV/src/RealCV.Web/Components/Routes.razor

25 lines
1.0 KiB
Plaintext
Raw Normal View History

<CascadingAuthenticationState>
<Router AppAssembly="typeof(Program).Assembly">
<Found Context="routeData">
<AuthorizeRouteView RouteData="routeData" DefaultLayout="typeof(Layout.MainLayout)">
<NotAuthorized>
@if (context.User.Identity?.IsAuthenticated != true)
{
<RedirectToLogin />
}
else
{
<div class="container py-5">
<div class="alert alert-danger" role="alert">
<h4 class="alert-heading">Access Denied</h4>
<p>You are not authorized to access this page.</p>
</div>
</div>
}
</NotAuthorized>
</AuthorizeRouteView>
<FocusOnNavigate RouteData="routeData" Selector="h1" />
</Found>
</Router>
</CascadingAuthenticationState>