25 lines
774 B
Plaintext
25 lines
774 B
Plaintext
@using Microsoft.AspNetCore.Components.Authorization
|
|
@using Microsoft.AspNetCore.Components.WebAssembly.Authentication
|
|
|
|
@inject NavigationManager Navigation
|
|
@inject SignOutSessionStateManager SignOutManager
|
|
|
|
<AuthorizeView>
|
|
<Authorized>
|
|
<a href="authentication/profile">Hello, @context.User.Identity?.Name!</a>
|
|
<button class="nav-link btn btn-link" @onclick="BeginSignOut">Log out</button>
|
|
</Authorized>
|
|
<NotAuthorized>
|
|
<a href="authentication/register">Register</a>
|
|
<a href="authentication/login">Log in</a>
|
|
</NotAuthorized>
|
|
</AuthorizeView>
|
|
|
|
@code{
|
|
private async Task BeginSignOut(MouseEventArgs args)
|
|
{
|
|
await SignOutManager.SetSignOutState();
|
|
Navigation.NavigateTo("authentication/logout");
|
|
}
|
|
}
|