@using Microsoft.AspNetCore.Components.WebAssembly.Authentication
@inject NavigationManager Navigation
@inject IAuthenticationClientService AuthenticationClientService

<AuthorizeView>
	<Authorized>
		<MudText>
			Hello, @context.User.Identity.Name!
		</MudText>
		<MudButton OnClick="Logout"> LOGOUT </MudButton>
	</Authorized>
	<NotAuthorized>
		<MudButton Class="" Href="Login"> Login </MudButton>
	</NotAuthorized>
</AuthorizeView>

@code {
	[CascadingParameter]
	private Task<AuthenticationState> authenticationStateTask { get; set; }

	private async Task Logout()
	{
		await AuthenticationClientService.LogoutAsync();
		Navigation.NavigateTo("/");
	}

	private void LoginIN()
	{
		Navigation.NavigateToLogin("/login");
	}

}