예제 #1
0
    private async Task ClearLogsAsync()
    {
        await AdminApi.ClearLogsAsync();

        await OnInitializedAsync();

        ToastService.DisplayToast("Logs vidés.", TimeSpan.FromSeconds(3), ToastType.Success, "clear-logs-admin", true);
        LogsTable.SetItems(Logs);
        ShowWarning = false;
    }
예제 #2
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);
        }
    }
예제 #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();
        }
    }