diff --git a/src/app/app-modules/core/services/http-interceptor.service.ts b/src/app/app-modules/core/services/http-interceptor.service.ts index 1a151b81..4fcb5b6d 100644 --- a/src/app/app-modules/core/services/http-interceptor.service.ts +++ b/src/app/app-modules/core/services/http-interceptor.service.ts @@ -89,24 +89,27 @@ export class HttpInterceptorService implements HttpInterceptor { this.spinnerService.setLoading(false); if (error.status === 401) { this.handleSessionExpiry( - this.currentLanguageSet.sessionExpiredPleaseLogin, + this.currentLanguageSet.sessionExpiredPleaseLogin || + 'Session has expired, please login again.', ); } else if (error.status === 403) { - this.confirmationService.alert( - this.currentLanguageSet.accessDenied, - 'error', + this.handleSessionExpiry( + this.currentLanguageSet.accessDenied || + 'Access Denied. You do not have permission to access this resource.', ); } else if (error.status === 500) { - this.confirmationService.alert( + this.handleSessionExpiry( this.currentLanguageSet.internaleServerError, - 'error', ); } else { - this.confirmationService.alert( - error.message || this.currentLanguageSet.somethingWentWrong, - 'error', + this.handleSessionExpiry( + error.message || + this.currentLanguageSet.somethingWentWrong || + 'Something went wrong. Please try again later.', ); } + sessionStorage.clear(); + this.sessionstorage.clear(); return throwError(error.error); }), ); diff --git a/src/app/app-modules/lab/worklist/worklist.component.ts b/src/app/app-modules/lab/worklist/worklist.component.ts index b0b2fddc..d86ce9eb 100644 --- a/src/app/app-modules/lab/worklist/worklist.component.ts +++ b/src/app/app-modules/lab/worklist/worklist.component.ts @@ -139,6 +139,9 @@ export class WorklistComponent implements OnInit, OnDestroy, DoCheck { } }, (err) => { + if (err?.handled) { + return; + } this.confirmationService.alert(err, 'error'); }, ); diff --git a/src/app/app-modules/nurse-doctor/doctor-worklist/doctor-worklist.component.ts b/src/app/app-modules/nurse-doctor/doctor-worklist/doctor-worklist.component.ts index 1f22d77a..d9df39dd 100644 --- a/src/app/app-modules/nurse-doctor/doctor-worklist/doctor-worklist.component.ts +++ b/src/app/app-modules/nurse-doctor/doctor-worklist/doctor-worklist.component.ts @@ -195,9 +195,18 @@ export class DoctorWorklistComponent implements OnInit, DoCheck, OnDestroy { sectionCount.sno = index + 1; }); this.filterTerm = null; - } else this.confirmationService.alert(data.errorMessage, 'error'); + } else { + console.log('Error in else part', data.errorMessage); + + this.confirmationService.alert(data.errorMessage, 'error'); + } }, (err) => { + if (err?.handled) { + console.log('error handled'); + + return; + } this.confirmationService.alert(err, 'error'); }, ); diff --git a/src/app/app-modules/nurse-doctor/nurse-worklist-wrapper/nurse-worklist/nurse-worklist.component.ts b/src/app/app-modules/nurse-doctor/nurse-worklist-wrapper/nurse-worklist/nurse-worklist.component.ts index 3db39f97..2c36c372 100644 --- a/src/app/app-modules/nurse-doctor/nurse-worklist-wrapper/nurse-worklist/nurse-worklist.component.ts +++ b/src/app/app-modules/nurse-doctor/nurse-worklist-wrapper/nurse-worklist/nurse-worklist.component.ts @@ -123,6 +123,9 @@ export class NurseWorklistComponent implements OnInit, DoCheck, OnDestroy { } else this.confirmationService.alert(res.errorMessage, 'error'); }, (err) => { + if (err?.handled) { + return; + } this.confirmationService.alert(err, 'error'); }, ); diff --git a/src/app/app-modules/pharmacist/worklist/worklist.component.ts b/src/app/app-modules/pharmacist/worklist/worklist.component.ts index 0246664c..0ebcb579 100644 --- a/src/app/app-modules/pharmacist/worklist/worklist.component.ts +++ b/src/app/app-modules/pharmacist/worklist/worklist.component.ts @@ -148,6 +148,9 @@ export class WorklistComponent implements OnInit, OnDestroy, DoCheck { } }, (err) => { + if (err?.handled) { + return; + } this.confirmationService.alert(err, 'error'); }, );