@inject AuthenticationStateProvider AuthStateProvider @inject IJSRuntime JSRuntime @inherits BlazorAdmin.Helpers.BlazorLayoutComponent
About eShopOnWeb
@Body
@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); } }