Add error handling and snackbar notifications

Introduces error state management in LoadingService, displays error bar and snackbar notifications in the UI, and updates ScheduleComponent to use the new error handling. Also adds custom theming for error snackbar and progress bar.
This commit is contained in:
2025-10-31 16:19:02 +01:00
parent 0828493be5
commit 5addba879a
6 changed files with 113 additions and 29 deletions

View File

@@ -4,6 +4,7 @@ import { Vorstellung } from '@infinimotion/model-frontend';
import { Performance } from '../model/performance.model';
import { MovieGroup } from '../model/movie-group.model';
import { LoadingService } from '../loading.service';
import { catchError, map, of, tap } from 'rxjs';
@Component({
selector: 'app-schedule',
@@ -47,14 +48,19 @@ export class ScheduleComponent implements OnInit {
loadPerformances() {
this.loading.show();
this.http.getPerformaces().subscribe({
next: (data) => {
this.performaces = Array.isArray(data) ? data : [data];
this.http.getPerformaces().pipe(
map(data => Array.isArray(data) ? data : [data]),
tap(performaces => {
this.performaces = performaces;
this.assignPerformancesToDates();
},
error: (err) => console.error('Fehler beim Laden der Performances', err),
complete: () => this.loading.hide()
});
this.loading.hide();
}),
catchError(err => {
this.loading.showError(err);
console.error('Fehler beim Laden der Vorstellung', err);
return of([]);
})
).subscribe();
}
assignPerformancesToDates() {