@using Shogi.Contracts.Types; @using System.ComponentModel.DataAnnotations; @using System.Net; @using System.Text.Json; @inject ShogiApi ShogiApi Creator Seats @foreach (var session in allSessions) { @session.Player1 @if (string.IsNullOrEmpty(session.Player2)) { 1 / 2 } else { Full } } @if (allSessions.Length == 0) { There are no games being played. } @code { private SessionMetadata[] allSessions = Array.Empty(); private SessionMetadata? activeSession; protected override Task OnInitializedAsync() { return FetchSessions(); } async Task FetchSessions() { var sessions = await ShogiApi.GetAllSessionsMetadata(); if (sessions != null) { this.allSessions = sessions.ToArray(); StateHasChanged(); } } }
There are no games being played.