Files
Moonlight/Moonlight.Frontend/UI/App.razor

54 lines
1.8 KiB
Plaintext

@using LucideBlazor
@using Microsoft.AspNetCore.Components.Authorization
@using ShadcnBlazor.Emptys
@using Moonlight.Frontend.UI.Components.Auth
@using Moonlight.Frontend.UI.Partials
@using Moonlight.Frontend.UI.Views
<ErrorBoundary>
<ChildContent>
<AuthorizeView>
<ChildContent>
<Router AppAssembly="@typeof(App).Assembly" NotFoundPage="typeof(NotFound)">
<Found Context="routeData">
<AuthorizeRouteView RouteData="routeData" DefaultLayout="typeof(MainLayout)">
<NotAuthorized Context="authRouteViewContext">
<AccessDenied/>
</NotAuthorized>
</AuthorizeRouteView>
</Found>
</Router>
</ChildContent>
<Authorizing>
<Authenticating/>
</Authorizing>
<NotAuthorized>
@if (context.User.Identity?.IsAuthenticated ?? false)
{
<AccessDenied/>
}
else
{
<Authentication/>
}
</NotAuthorized>
</AuthorizeView>
</ChildContent>
<ErrorContent>
<div class="m-10">
<Empty>
<EmptyHeader>
<EmptyMedia Variant="EmptyMediaVariant.Icon">
<OctagonAlertIcon ClassName="text-red-500/80"/>
</EmptyMedia>
<EmptyTitle>
Critical Application Error
</EmptyTitle>
<EmptyDescription>
@context.ToString()
</EmptyDescription>
</EmptyHeader>
</Empty>
</div>
</ErrorContent>
</ErrorBoundary>