Ejemplo n.º 1
0
    private async void OnConfirmDeleteAsync(int challengeId)
    {
        try
        {
            await ChallengesApi.DeleteAsync(challengeId);
            await OnInitializedAsync();

            ChallengesTable.SetItems(Challenges);
            StateHasChanged();
        }
        catch (ApiException e)
        {
            ToastService.DisplayToast(e.Content ?? "Une erreur est survenue", null, ToastType.Error, "challenge-delete", true);
        }
    }
Ejemplo n.º 2
0
    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();
        }
    }
Ejemplo n.º 3
0
    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();
        }
    }
Ejemplo n.º 4
0
 protected override async Task OnInitializedAsync()
 {
     Challenges = await ChallengesApi.GetAllAsAdminViewAsync();
 }