36 lines
1.0 KiB
Plaintext
36 lines
1.0 KiB
Plaintext
@using Microsoft.AspNetCore.Components.Routing
|
|
@inject Atomx.Admin.Client.Services.ILocalizationProvider LocalizationProvider
|
|
|
|
<Router AppAssembly="typeof(Program).Assembly">
|
|
<Found Context="routeData">
|
|
<CascadingValue Value="routeData">
|
|
<AuthorizeRouteView RouteData="routeData" DefaultLayout="typeof(Layout.MainLayout)">
|
|
<NotAuthorized>
|
|
<RedirectToLogin />
|
|
</NotAuthorized>
|
|
</AuthorizeRouteView>
|
|
</CascadingValue>
|
|
<FocusOnNavigate RouteData="routeData" Selector="h1" />
|
|
</Found>
|
|
</Router>
|
|
<AntContainer />
|
|
|
|
@code {
|
|
private bool _initialized;
|
|
|
|
protected override async Task OnAfterRenderAsync(bool firstRender)
|
|
{
|
|
if (firstRender && !_initialized)
|
|
{
|
|
_initialized = true;
|
|
try
|
|
{
|
|
if (LocalizationProvider != null)
|
|
{
|
|
await LocalizationProvider.InitializeAsync();
|
|
}
|
|
}
|
|
catch { }
|
|
}
|
|
}
|
|
} |