From 40801577406f030eaf5df56c9a8414011cc3a3a6 Mon Sep 17 00:00:00 2001 From: Vaibhav Mittal Date: Mon, 17 Oct 2022 15:52:23 +0530 Subject: [PATCH] Fix login error undefined --- src/app/Hospitals/login/login.component.ts | 8 ++++++-- .../login-patient/login-patient.component.ts | 13 +++++++++++-- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/app/Hospitals/login/login.component.ts b/src/app/Hospitals/login/login.component.ts index ac073d3..208bf70 100644 --- a/src/app/Hospitals/login/login.component.ts +++ b/src/app/Hospitals/login/login.component.ts @@ -68,12 +68,16 @@ export class LoginComponent implements OnInit { }, (Error) => { this.err = Error.error.message; - alert(this.err); + if(Error.error.status === 500){ + this.err = "Incorrect Email Id or Password !"; + } + alert(this.err); + Swal.fire({ icon: 'error', title: 'Oops...', - text: ('${this.err}'), + text: (`${this.err}`), footer: 'Why do I have this issue?' }) }); diff --git a/src/app/Patients/login-patient/login-patient.component.ts b/src/app/Patients/login-patient/login-patient.component.ts index c7eb5b6..8aa29f2 100644 --- a/src/app/Patients/login-patient/login-patient.component.ts +++ b/src/app/Patients/login-patient/login-patient.component.ts @@ -18,6 +18,7 @@ export class LoginPatientComponent implements OnInit { PLoginForm !: FormGroup; id ! : number; light ! : string; + err !: String; fieldTextType: boolean = false; constructor(private fb: FormBuilder, private patientServ : PatientService, private router : Router, private sharingService:SharingService) { } @@ -71,8 +72,16 @@ export class LoginPatientComponent implements OnInit { this.router.navigate(['patient-dashboard',this.id]); },1000); }, - (Error) =>{alert(Error.error.message)} - ); + (Error) =>{ + this.err = "Incorrect Email Id or Password !"; + alert(this.err); + Swal.fire({ + icon: 'error', + title: 'Oops...', + text: (`${this.err}`), + footer: 'Why do I have this issue?' + }) + }); this.PLoginForm.reset({ emailId: '',