22 lines
574 B
Plaintext
22 lines
574 B
Plaintext
<AuthorizeView>
|
|
<Authorized>
|
|
Hello, @(LoggedInName)!
|
|
<a href="api/Account/logout">Log out</a>
|
|
</Authorized>
|
|
<NotAuthorized>
|
|
<a href="api/account/login?redirect=/">Log in</a>
|
|
</NotAuthorized>
|
|
</AuthorizeView>
|
|
|
|
@code {
|
|
[CascadingParameter]
|
|
Task<AuthenticationState> AuthenticationState { get; set; }
|
|
private string LoggedInName { get; set; }
|
|
protected override async Task OnInitializedAsync()
|
|
{
|
|
await base.OnInitializedAsync();
|
|
LoggedInName = (await AuthenticationState).User.Identity.Name;
|
|
}
|
|
|
|
}
|