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