diff --git a/src/Vegasco-Web/src/app/api/models/get-consumption-entries-response.ts b/src/Vegasco-Web/src/app/api/models/get-consumption-entries-response.ts new file mode 100644 index 0000000..c4099c4 --- /dev/null +++ b/src/Vegasco-Web/src/app/api/models/get-consumption-entries-response.ts @@ -0,0 +1,3 @@ +interface GetConsumptionEntriesResponse { + consumptions: ConsumptionEntry[]; +} \ No newline at end of file diff --git a/src/Vegasco-Web/src/app/modules/entries/entries/entries.component.html b/src/Vegasco-Web/src/app/modules/entries/entries/entries.component.html index dce0f49..ab67d54 100644 --- a/src/Vegasco-Web/src/app/modules/entries/entries/entries.component.html +++ b/src/Vegasco-Web/src/app/modules/entries/entries/entries.component.html @@ -1,22 +1,22 @@ @if (consumptionEntries$ | async; as consumptionEntries) { -
- - - - - - - - - - @for (entry of consumptionEntries; track entry.id) { - - - - - - } - -
DatumDistanzMenge
{{ entry.dateTime | date }}{{ entry.distance }} km{{ entry.amount }} l
-
-} \ No newline at end of file +
+ + + + + + + + + + @for (entry of consumptionEntries; track entry.id) { + + + + + + } + +
DatumDistanzMenge
{{ entry.dateTime | date }}{{ entry.distance }} km{{ entry.amount }} l
+
+} diff --git a/src/Vegasco-Web/src/app/modules/entries/entries/entries.component.ts b/src/Vegasco-Web/src/app/modules/entries/entries/entries.component.ts index c9e5b8a..7015883 100644 --- a/src/Vegasco-Web/src/app/modules/entries/entries/entries.component.ts +++ b/src/Vegasco-Web/src/app/modules/entries/entries/entries.component.ts @@ -2,7 +2,7 @@ import { AsyncPipe, DatePipe } from '@angular/common'; import { HttpClient } from '@angular/common/http'; import { Component, inject } from '@angular/core'; import { takeUntilDestroyed } from '@angular/core/rxjs-interop'; -import { Observable, tap } from 'rxjs'; +import { map, Observable, tap } from 'rxjs'; @Component({ selector: 'app-entries', @@ -16,12 +16,13 @@ export class EntriesComponent { protected readonly consumptionEntries$: Observable; constructor() { - this.consumptionEntries$ = this.http.get('/api/v1/consumptions') + this.consumptionEntries$ = this.http.get('/api/v1/consumptions') .pipe( takeUntilDestroyed(), tap((response) => { console.log('Entries response:', response); }), + map(response => response.consumptions) ); } }