From f28cc3bacb1d84c5596024a3cbb151ab8d1755b8 Mon Sep 17 00:00:00 2001 From: Kai Moritz Date: Sun, 7 Sep 2025 13:28:07 +0200 Subject: [PATCH] =?utf8?q?WIP:=20vollst=C3=A4ndiger,=20aber=20ggf.=20unn?= =?utf8?q?=C3=B6tig?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/app/services/auth.service.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/app/services/auth.service.ts b/src/app/services/auth.service.ts index 26bf98e..22c9d0e 100644 --- a/src/app/services/auth.service.ts +++ b/src/app/services/auth.service.ts @@ -1,6 +1,6 @@ import { Injectable } from '@angular/core'; import { Router } from "@angular/router"; -import { of } from 'rxjs'; +import { Observable, of, throwError } from 'rxjs'; @Injectable({ providedIn: 'root' @@ -10,10 +10,10 @@ export class AuthService { constructor(private router : Router) { } - login(username : string, password : string) { + login(username : string, password : string) : Observable { const shouldFail = Math.random() < 0.3; // 30% Fehlerchance if (shouldFail) { - throw new Error('Simulierter Fehler im Service'); + return throwError(() => new Error('Simulierter Fehler im Service')); } this.username = username; return of(username); -- 2.20.1