Revert to using manually created api classes
This commit is contained in:
@@ -1,19 +1,24 @@
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { Component, inject } from '@angular/core';
|
||||
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
||||
import { ReactiveFormsModule } from '@angular/forms';
|
||||
import { FormControl, ReactiveFormsModule } from '@angular/forms';
|
||||
import { RouterLink } from '@angular/router';
|
||||
import { MessageService } from 'primeng/api';
|
||||
import { ButtonModule } from 'primeng/button';
|
||||
import { DataViewModule } from 'primeng/dataview';
|
||||
import { ScrollTopModule } from 'primeng/scrolltop';
|
||||
import { SelectModule } from 'primeng/select';
|
||||
import { ScrollTopModule } from 'primeng/scrolltop';
|
||||
import { SkeletonModule } from 'primeng/skeleton';
|
||||
import {
|
||||
BehaviorSubject,
|
||||
combineLatest,
|
||||
map,
|
||||
Observable,
|
||||
tap
|
||||
of,
|
||||
startWith,
|
||||
tap,
|
||||
} from 'rxjs';
|
||||
import { Client, GetConsumptions_ResponseDto } from '../../../shared/api/swagger.generated';
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
||||
|
||||
@Component({
|
||||
selector: 'app-entries',
|
||||
@@ -31,24 +36,18 @@ import { Client, GetConsumptions_ResponseDto } from '../../../shared/api/swagger
|
||||
styleUrl: './entries.component.scss'
|
||||
})
|
||||
export class EntriesComponent {
|
||||
private readonly client = inject(Client);
|
||||
private readonly http = inject(HttpClient);
|
||||
|
||||
protected readonly consumptionEntries$: Observable<GetConsumptions_ResponseDto[] | undefined>;
|
||||
|
||||
protected readonly rowsPerPageDefaultOption = 25;
|
||||
protected readonly rowsPerPageOptions = [10, 25, 50, 100];
|
||||
protected readonly currentPageReportTemplate = '{currentPage} / {totalPages}';
|
||||
|
||||
protected readonly skeletonsIterationSource = Array(10).fill(0);
|
||||
protected readonly consumptionEntries$: Observable<ConsumptionEntry[]>;
|
||||
|
||||
constructor() {
|
||||
this.consumptionEntries$ = this.client.consumptionsGET()
|
||||
this.consumptionEntries$ = this.http.get<GetConsumptionEntriesResponse>('/api/v1/consumptions')
|
||||
.pipe(
|
||||
takeUntilDestroyed(),
|
||||
tap((response) => {
|
||||
console.log('Entries response:', response);
|
||||
}),
|
||||
map((response) => response.consumptions)
|
||||
)
|
||||
map(response => response.consumptions)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user