Improve login error message

This commit is contained in:
aditya.chandel
2025-03-13 12:51:53 -06:00
committed by Aditya Chandel
parent 04e517f406
commit 3c1288edc8
@@ -42,8 +42,12 @@ export class LoginComponent {
this.router.navigate(['/dashboard']);
}
},
error: () => {
this.errorMessage = 'Invalid username or password';
error: (error) => {
if (error.status === 0) {
this.errorMessage = 'Cannot connect to the server. Please check your connection and try again.';
} else {
this.errorMessage = error?.error?.message || 'An unexpected error occurred. Please try again.';
}
}
});
}