protected override async Task OnInitializedAsync() { ApiResponse <ChallengeDetailDto> response = await ChallengesApi.GetAsync(Id); if (!response.IsSuccessStatusCode || response.Content is null) { ChallengeFound = false; } else { Loaded = true; ChallengeFound = true; Challenge = response.Content; StateHasChanged(); } }
private async Task RefreshAsync() { try { PopupService.DisplayLoader("Restoration"); await ChallengesApi.ImportChallengeAsync(new() { GeoGuessrId = Challenge.GeoGuessrId, OverrideData = true }); ApiResponse <ChallengeDetailDto> response = await ChallengesApi.GetAsync(Challenge.Id); Challenge = response.Content !; } catch (ApiException e) { ToastService.DisplayToast(e.Content ?? "Echec de l'opération", null, ToastType.Error, "challenge-refresh", true); } finally { PopupService.HidePopup(); StateHasChanged(); } }