diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 2d9f8e6..ec6d281 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -47,7 +47,6 @@ import { MenuListItemComponent } from './components/menu-list-item/menu-list-ite import { SidenavProfileComponent } from './components/sidenav-profile/sidenav-profile.component'; import { NavService } from './components/menu-list-item/nav.service'; import { TokenInterceptor } from './helper/token.interceptor'; -import { HttpErrorInterceptor } from './helper/http-error.interceptor'; import { BikeComponent } from './pages/dataPages/bike/bike.component'; import { TableComponent, diff --git a/src/app/helper/token.interceptor.ts b/src/app/helper/token.interceptor.ts index 706d484..9ea99ba 100644 --- a/src/app/helper/token.interceptor.ts +++ b/src/app/helper/token.interceptor.ts @@ -27,14 +27,18 @@ export class TokenInterceptor implements HttpInterceptor { } else { //server error; if (error.status === 401) { - - return this.handle401Error(request, next); + var urlSplit : string[] = error.url.split("/"); + if (urlSplit[3] === "users" && urlSplit[5] === "update"){ + errorMessage = "Das aktuelle Passwort ist inkorrekt."; + } else { + return this.handle401Error(request, next); + } } else { - errorMessage = `Error Code: ${error.status}\nMessage: ${error.message}`; + errorMessage = `Error Code: ${error.status}\nMessage: ${error.message}.`; } } this.snackBar.openSnackBar(errorMessage, "Ok", true); - //return throwError(errorMessage); + return throwError(errorMessage); })); } diff --git a/src/app/pages/profile/profile.component.ts b/src/app/pages/profile/profile.component.ts index ad1e845..bf23833 100644 --- a/src/app/pages/profile/profile.component.ts +++ b/src/app/pages/profile/profile.component.ts @@ -67,12 +67,6 @@ export class ProfileComponent implements OnInit { data => { this.snackBar.openSnackBar("Das Passwort wurde erfolgreich aktualisiert", "Ok"); console.log(JSON.stringify(data)); - }, - (error) => { - this.errorOccurred = true; - this.errorMessage = - error.error.message || - 'Ein Fehler ist aufgetreten. Bitte melden sie dies ihrem Administrator.'; } ) .add(() => {