@page "/user"
@attribute [Authorize]

@using Microsoft.AspNetCore.Components.WebAssembly.Authentication

@inject NavigationManager Navigation

<AuthorizeView>
    <Authorized>
        <div class="d-flex flex-column m-3">
            <h3>User <b>@context.User.Identity?.Name</b></h3>
            <div>
                <MudButton Variant="Variant.Filled" StartIcon="@Icons.Material.Filled.Logout" IconColor="Color.Secondary" Size="Size.Large" OnClick="BeginLogOut">Logout</MudButton>
            </div>
        </div>
    </Authorized>
</AuthorizeView>

@code {

    public void BeginLogOut()
    {
        Navigation.NavigateToLogout("authentication/logout");
    }
}
