@inherits LayoutComponentBase
@using Services
@inject IAccountService AccountService
<div class="page">
<div class="sidebar">
<NavMenu />
</div>
<div class="main">
<div class="top-row px-4">
@if (AccountService.User != null)
{
<NavLink href="users/selfedit" class="nav-item nav-link">@AccountService.User.Username</NavLink>
<NavLink href="account/logout" class="nav-item nav-link">Logout</NavLink>
}
else
{
<NavLink href="account/login" class="nav-item nav-link">Login</NavLink>
}
<a href="https://docs.microsoft.com/aspnet/" target="_blank">About</a>
</div>
<div class="content px-4">
<div class="float-right">
<Alert />
</div>
@Body
</div>
</div>
</div>
<NavLink href="users/selfedit" class="nav-item nav-link">@AccountService.User.Username</NavLink>
... the logout process works well.
An exception of type 'System.InvalidOperationException' occurred in System.Private.CoreLib.dll but was not handled in user code: 'JavaScript interop calls cannot be issued at this time. This is because the component is being statically rendered. When prerendering is enabled, JavaScript interop calls can only be performed during the OnAfterRenderAsync lifecycle method.
But I do not quite comprehend that error.