This commit is contained in:
2023-01-28 13:21:47 -06:00
parent 11b387b928
commit 8a25c0ed35
26 changed files with 443 additions and 359 deletions

View File

@@ -1,7 +1,27 @@
@using Contracts.Types;
@using System.Net;
@inject IShogiApi ShogiApi;
<GameBoardPresentation IsSpectating="true" Perspective="WhichPlayer.Player1" Session="Session" />
<GameBoardPresentation IsSpectating="true"
Perspective="WhichPlayer.Player1"
Session="Session"
OnClickJoinGame="OnClickJoinGame" />
@code {
[Parameter] public Session Session { get; set; }
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.SessionName);
response.EnsureSuccessStatusCode();
}
}