Replace custom socket implementation with SignalR.
Replace MSAL and custom cookie auth with Microsoft.Identity.EntityFramework Also some UI redesign to accommodate different login experience.
This commit is contained in:
52
Shogi.UI/Layout/NavMenu.razor
Normal file
52
Shogi.UI/Layout/NavMenu.razor
Normal file
@@ -0,0 +1,52 @@
|
||||
@inject NavigationManager navigator
|
||||
@inject ShogiApi Api
|
||||
|
||||
<div class="NavMenu PrimaryTheme ThemeVariant--Contrast">
|
||||
<h1>Shogi</h1>
|
||||
<p>
|
||||
<a href="/">Home</a>
|
||||
</p>
|
||||
|
||||
<AuthorizeView>
|
||||
<p>
|
||||
<a href="/search">Search</a>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<button class="href" @onclick="CreateSession">Create</button>
|
||||
</p>
|
||||
</AuthorizeView>
|
||||
|
||||
<div class="spacer" />
|
||||
|
||||
<AuthorizeView>
|
||||
<Authorized>
|
||||
<p>@context.User.Identity?.Name</p>
|
||||
<p>
|
||||
<a href="logout">Logout</a>
|
||||
</p>
|
||||
</Authorized>
|
||||
<NotAuthorized>
|
||||
<p>
|
||||
<a href="login">Login</a>
|
||||
</p>
|
||||
<p>
|
||||
<a href="register">Register</a>
|
||||
</p>
|
||||
</NotAuthorized>
|
||||
</AuthorizeView>
|
||||
</div>
|
||||
|
||||
|
||||
@code {
|
||||
|
||||
async Task CreateSession()
|
||||
{
|
||||
var sessionId = await Api.PostSession();
|
||||
if (!string.IsNullOrEmpty(sessionId))
|
||||
{
|
||||
navigator.NavigateTo($"/play/{sessionId}");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user