@inject AuthenticationStateProvider AuthStateProvider
@inject IJSRuntime JSRuntime
@inherits BlazorAdmin.Helpers.BlazorLayoutComponent
@code
{
protected override async Task OnAfterRenderAsync(bool firstRender)
{
if (firstRender)
{
var authState = await AuthStateProvider.GetAuthenticationStateAsync();
if (authState.User == null)
{
await new Route(JSRuntime).RouteOutside("/Identity/Account/Login");
}
CallRequestRefresh();
}
await base.OnAfterRenderAsync(firstRender);
}
}