Files
Shogi/Shogi.UI/Pages/Identity/LogoutPage.razor
2024-08-25 15:01:05 -05:00

30 lines
622 B
Plaintext

@page "/logout"
@inject IAccountManagement Acct
<main class="PrimaryTheme">
<h1>Logout</h1>
<AuthorizeView @ref="authView">
<Authorized>
<div class="alert alert-info">Logging you out...</div>
</Authorized>
<NotAuthorized>
<p>Thanks for playing!</p>
<div class="alert alert-success">You're logged out. <a href="login">Log in.</a></div>
</NotAuthorized>
</AuthorizeView>
</main>
@code {
private AuthorizeView? authView;
protected override async Task OnInitializedAsync()
{
if (await Acct.CheckAuthenticatedAsync())
{
await Acct.LogoutAsync();
}
await base.OnInitializedAsync();
}
}