[WIP] Switched from rest to GraphQL #162-2

This commit is contained in:
2023-02-09 16:09:34 +01:00
parent 4266db7e35
commit 6aca981fd1
7 changed files with 59 additions and 25 deletions

View File

@@ -3,13 +3,15 @@ import { FormBuilder, FormControl, FormGroup } from "@angular/forms";
import { Router } from "@angular/router";
import { TranslateService } from "@ngx-translate/core";
import { LazyLoadEvent } from "primeng/api";
import { debounceTime } from "rxjs";
import { debounceTime, throwError } from "rxjs";
import { ConfirmationDialogService } from "src/app/services/confirmation-dialog/confirmation-dialog.service";
import { DataService } from "src/app/services/data/data.service";
import { ServerService } from "src/app/services/data/server.service";
import { SpinnerService } from "src/app/services/spinner/spinner.service";
import { ToastService } from "src/app/services/toast/toast.service";
import { Server } from "../../../../../models/data/server.model";
import { catchError } from "rxjs/operators";
import { Queries } from "../../../../../models/graphql/queries.model";
@Component({
selector: 'app-dashboard',
@@ -71,14 +73,14 @@ export class DashboardComponent implements OnInit {
async loadNextPage() {
this.spinnerService.showSpinner();
// this.data.getFilteredServers(this.searchCriterions).pipe(catchError(err => {
// this.spinnerService.hideSpinner();
// return throwError(() => err);
// })).subscribe(list => {
// this.totalRecords = list.totalCount;
// this.servers = list.servers;
// this.spinnerService.hideSpinner();
// });
this.data.query(Queries.serverInfoQuery).pipe(catchError(err => {
this.spinnerService.hideSpinner();
return throwError(() => err);
})).subscribe(data => {
this.totalRecords = data.data.serverCount;
this.servers = data.data.servers;
this.spinnerService.hideSpinner();
});
}
nextPage(event: LazyLoadEvent) {