49 lines
985 B
Plaintext
49 lines
985 B
Plaintext
@using Shogi.Contracts.Types;
|
|
@using System.ComponentModel.DataAnnotations;
|
|
@using System.Net;
|
|
@using System.Text.Json;
|
|
|
|
@inject ShogiApi ShogiApi
|
|
|
|
<section class="GameBrowser PrimaryTheme ThemeVariant--Contrast">
|
|
<div class="table">
|
|
<row class="header">
|
|
<span>Creator</span>
|
|
<span>Seats</span>
|
|
<span></span>
|
|
</row>
|
|
<hr />
|
|
@foreach (var session in allSessions)
|
|
{
|
|
<row>
|
|
<GameBrowserEntry Session="session" OnSessionDeleted="FetchSessions" />
|
|
</row>
|
|
}
|
|
</div>
|
|
|
|
@if (allSessions.Length == 0)
|
|
{
|
|
<p>There are no games being played.</p>
|
|
}
|
|
</section>
|
|
|
|
@code {
|
|
private SessionMetadata[] allSessions = Array.Empty<SessionMetadata>();
|
|
|
|
protected override Task OnInitializedAsync()
|
|
{
|
|
return FetchSessions();
|
|
}
|
|
|
|
async Task FetchSessions()
|
|
{
|
|
var sessions = await ShogiApi.GetAllSessionsMetadata();
|
|
Console.WriteLine("Session count {0}", sessions.Length);
|
|
if (sessions != null)
|
|
{
|
|
this.allSessions = sessions;
|
|
StateHasChanged();
|
|
}
|
|
}
|
|
}
|