diff --git a/frontend/src/app/feature/auth/login/login.component.html b/frontend/src/app/feature/auth/login/login.component.html
index c10b232..40fc3e6 100644
--- a/frontend/src/app/feature/auth/login/login.component.html
+++ b/frontend/src/app/feature/auth/login/login.component.html
@@ -2,9 +2,11 @@
Anmelden
-
- {{ errorMessage }}
-
+ @if (errorMessage()) {
+
+ {{ errorMessage() }}
+
+ }
diff --git a/frontend/src/app/feature/auth/login/login.component.ts b/frontend/src/app/feature/auth/login/login.component.ts
index 1ed3537..8874dbc 100644
--- a/frontend/src/app/feature/auth/login/login.component.ts
+++ b/frontend/src/app/feature/auth/login/login.component.ts
@@ -1,8 +1,8 @@
-import { Component } from '@angular/core';
+import { Component, signal } from '@angular/core';
import { FormBuilder, FormGroup, ReactiveFormsModule, Validators } from '@angular/forms';
import { Router, RouterLink } from '@angular/router';
import { LoginRequest } from '../../../model/auth/LoginRequest';
-import { AuthService } from '../../../service/auth.service';
+import { AuthService } from '@service/auth.service';
import { CommonModule } from '@angular/common';
@Component({
@@ -13,8 +13,8 @@ import { CommonModule } from '@angular/common';
})
export class LoginComponent {
loginForm: FormGroup;
- errorMessage = '';
- isLoading = false;
+ errorMessage = signal('');
+ isLoading = signal(false);
constructor(
private fb: FormBuilder,
@@ -36,8 +36,8 @@ export class LoginComponent {
return;
}
- this.isLoading = true;
- this.errorMessage = '';
+ this.isLoading.set(true);
+ this.errorMessage.set('');
const loginRequest: LoginRequest = {
usernameOrEmail: this.form['usernameOrEmail'].value,
@@ -49,8 +49,10 @@ export class LoginComponent {
this.router.navigate(['/home']);
},
error: (err) => {
- this.isLoading = false;
- this.errorMessage = err.error?.message || 'Failed to login. Please check your credentials.';
+ this.isLoading.set(false);
+ this.errorMessage.set(
+ err.error?.message || 'Failed to login. Please check your credentials.'
+ );
},
});
}