fix(auth): Fehlermeldung bei 401 unauthorized während der Login-Prüfung verhindern

Überspringe die Anzeige der Fehlermeldung in isAuthenticated, wenn der Antwortstatus 401,
ist, was typischerweise anzeigt, dass der Benutzer einfach nicht eingeloggt ist, nicht ein Serverproblem.
This commit is contained in:
tekh 2025-07-22 10:33:42 +02:00
parent 963ab12488
commit 437f33a323

View File

@ -17,20 +17,20 @@ export class AuthenticationService {
constructor(
private router: Router,
private http: HttpClient,
urlService : UrlService)
{
this.loginUrl = urlService.apiRoute.login;
this.logoutUrl = urlService.apiRoute.logout;
this.checkUrl = urlService.apiRoute.loginCheck;
}
urlService: UrlService) {
this.loginUrl = urlService.apiRoute.login;
this.logoutUrl = urlService.apiRoute.logout;
this.checkUrl = urlService.apiRoute.loginCheck;
}
async isAuthenticated(): Promise<boolean> {
try {
const response = await firstValueFrom(this.http.get<boolean>(this.checkUrl, { withCredentials: true }));
_isLogedIn = response;
return response;
} catch (error) {
this.showErrorAlert();
} catch (error: any) {
if (error?.status !== 401)
this.showErrorAlert();
return false;
}
}