diff --git a/src/app/login/login.component.ts b/src/app/login/login.component.ts index c5315ce..257917e 100644 --- a/src/app/login/login.component.ts +++ b/src/app/login/login.component.ts @@ -26,22 +26,10 @@ export class LoginComponent implements OnInit { } } - errorParser(err: any) { - switch (err.status) { - case 401: - this.error = "Zła nazwa użytkownika lub hasło" - break; - - default: - this.error = "Nieznany błąd" - break; - } - } - submit() { const val = this.form.value this.ac.login(val.uname, val.pass).pipe(catchError((err,caught)=>{ - this.errorParser(err) + this.error = err.error.message return throwError(() => new Error(err.message)) })).subscribe((data) => { this.ls.loggedIn = true diff --git a/src/app/types/status.ts b/src/app/types/status.ts index dd47250..faf2ff4 100644 --- a/src/app/types/status.ts +++ b/src/app/types/status.ts @@ -1,3 +1,4 @@ export interface Status { - status: number + status: number, + message?: string }