import { Injectable } from '@angular/core';
import { Router } from "@angular/router";
+import { of } from 'rxjs';
@Injectable({
providedIn: 'root'
constructor(private router : Router) { }
login(username : string, password : string) {
+ const shouldFail = Math.random() < 0.3; // 30% Fehlerchance
+ if (shouldFail) {
+ throw new Error('Simulierter Fehler im Service');
+ }
this.username = username;
+ return of(username);
}
assertUserIsKnown(): void {