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:
29
Shogi.UI/Pages/Play/GameBoard/SpectatorGameBoard.razor
Normal file
29
Shogi.UI/Pages/Play/GameBoard/SpectatorGameBoard.razor
Normal file
@@ -0,0 +1,29 @@
|
||||
@using Contracts.Types
|
||||
@using System.Net
|
||||
@inject ShogiApi ShogiApi
|
||||
|
||||
<GameBoardPresentation IsSpectating="true"
|
||||
Perspective="WhichPlayer.Player2"
|
||||
Session="Session"
|
||||
OnClickJoinGame="OnClickJoinGame" />
|
||||
|
||||
@code {
|
||||
[Parameter]
|
||||
[EditorRequired]
|
||||
public Session Session { get; set; } = default!;
|
||||
|
||||
protected override void OnParametersSet()
|
||||
{
|
||||
base.OnParametersSet();
|
||||
if (Session == null)
|
||||
{
|
||||
throw new ArgumentException($"{nameof(Session)} cannot be null.", nameof(Session));
|
||||
}
|
||||
}
|
||||
|
||||
async Task OnClickJoinGame()
|
||||
{
|
||||
var response = await ShogiApi.PatchJoinGame(Session.SessionId.ToString());
|
||||
response.EnsureSuccessStatusCode();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user