Code cleanup #247

This commit is contained in:
2023-03-09 11:10:53 +01:00
parent 21f0f32322
commit 04fcfddbd9
14 changed files with 104 additions and 90 deletions

View File

@@ -2,7 +2,7 @@ import { HttpClient, HttpHeaders } from "@angular/common/http";
import { Injectable } from "@angular/core";
import { Router } from "@angular/router";
import { JwtHelperService } from "@auth0/angular-jwt";
import { firstValueFrom, Observable, Subject, Subscription } from "rxjs";
import { firstValueFrom, Observable, Subject, Subscription, throwError } from "rxjs";
import { catchError } from "rxjs/operators";
import { AdminUpdateUserDTO } from "src/app/models/auth/admin-update-user.dto";
import { AuthRoles } from "src/app/models/auth/auth-roles.enum";
@@ -231,7 +231,7 @@ export class AuthService {
this.isLoggedIn$.next(false);
localStorage.removeItem("rjwt");
this.router.navigate(["/auth/login"]);
throw error;
return throwError(() => error);
})).subscribe(() => {
this.isLoggedIn$.next(false);
localStorage.removeItem("jwt");