protected override void OnInitialized() { editContext = new EditContext(customGameSettings); gameLevels = GameLevelsService.GetGameLevels(); selectedLevel = gameLevels.FirstOrDefault(); }
protected override async Task OnInitializedAsync() { gameLevels = GameLevelsService.GetGameLevels(); selectedLevel = gameLevels.First().Name; var response = await HttpClient.GetAsync($"api/statistic/{selectedLevel}"); if (response.IsSuccessStatusCode) { currentLevelStatistic = await response.Content.ReadFromJsonAsync <StatisticModel>(); currentLevelStatistic.BestGames = currentLevelStatistic.BestGames.OrderBy(r => r.DurationInSeconds).ToList(); } else if (response.StatusCode == HttpStatusCode.Unauthorized) { NavigationManager.NavigateTo("/login/statistics"); } }