squash a bunch of commits
This commit is contained in:
31
Shogi.UI/Pages/Home/PageHeader.razor
Normal file
31
Shogi.UI/Pages/Home/PageHeader.razor
Normal file
@@ -0,0 +1,31 @@
|
||||
@inject AccountState Account
|
||||
@inject AccountManager AccountManager
|
||||
|
||||
<div class="pageHeader">
|
||||
<h1>Shogi</h1>
|
||||
@if (user != null)
|
||||
{
|
||||
<div class="user">
|
||||
<div>@user.DisplayName</div>
|
||||
<button type="button" class="logout" @onclick="AccountManager.LogoutAsync">Logout</button>
|
||||
</div>
|
||||
}
|
||||
@*<LoginDisplay />*@
|
||||
</div>
|
||||
|
||||
@code {
|
||||
private User? user;
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
Account.LoginChangedEvent += OnLoginChange;
|
||||
}
|
||||
|
||||
private void OnLoginChange(object? sender, LoginEventArgs args)
|
||||
{
|
||||
if (args == null)
|
||||
throw new ArgumentException(nameof(args));
|
||||
user = args.User;
|
||||
StateHasChanged();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user