From 171f69df23cd9c072d0cca1affb44a3bdeaf0c24 Mon Sep 17 00:00:00 2001 From: Sneha Date: Tue, 4 Aug 2026 12:03:21 +0530 Subject: [PATCH] fix(pharmacist): stop silent failure when redirecting to Inventory MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit InventoryService.current_language_set was declared but never assigned, so the guard's error-alert branch threw instead of showing a message whenever authKey/facility/host was missing — masking the real problem and making the redirect look like a no-op. Populate it from HttpServiceService.currentLangugae$, the same pattern AuthGuard already uses. Also guard getppID() against a missing serviceLineDetails entry (JSON.parse(null).parkingPlaceID threw before the redirect could fire), and fix the setLanguage fallback check in worklist.component (sessionStorage.getItem returns null, never undefined). --- src/app/app-modules/core/services/inventory.service.ts | 9 ++++++++- .../pharmacist/worklist/worklist.component.ts | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/app/app-modules/core/services/inventory.service.ts b/src/app/app-modules/core/services/inventory.service.ts index e164ff5b..78c5b44e 100644 --- a/src/app/app-modules/core/services/inventory.service.ts +++ b/src/app/app-modules/core/services/inventory.service.ts @@ -3,6 +3,7 @@ import { Injectable, Inject } from '@angular/core'; import { environment } from '../../../../environments/environment'; import { ConfirmationService } from '../../core/services/confirmation.service'; import { SessionStorageService } from 'Common-UI/src/registrar/services/session-storage.service'; +import { HttpServiceService } from './http-service.service'; @Injectable() export class InventoryService { inventoryUrl: any; @@ -12,7 +13,12 @@ export class InventoryService { @Inject(DOCUMENT) private document: any, readonly sessionstorage: SessionStorageService, private confirmationService: ConfirmationService, - ) {} + private httpServiceService: HttpServiceService, + ) { + this.httpServiceService.currentLangugae$.subscribe( + (response) => (this.current_language_set = response), + ); + } moveToInventory( benID: any, @@ -80,6 +86,7 @@ export class InventoryService { getppID() { const serviceLineDetailsData: any = this.sessionstorage.getItem('serviceLineDetails'); + if (!serviceLineDetailsData) return undefined; const serviceLineDetails = JSON.parse(serviceLineDetailsData); return serviceLineDetails.parkingPlaceID; } diff --git a/src/app/app-modules/pharmacist/worklist/worklist.component.ts b/src/app/app-modules/pharmacist/worklist/worklist.component.ts index 0ebcb579..f8f442e6 100644 --- a/src/app/app-modules/pharmacist/worklist/worklist.component.ts +++ b/src/app/app-modules/pharmacist/worklist/worklist.component.ts @@ -318,7 +318,7 @@ export class WorklistComponent implements OnInit, OnDestroy, DoCheck { beneficiary.visitCode, beneficiary.benFlowID, beneficiary.beneficiaryRegID, - sessionStorage.getItem('setLanguage') !== undefined + sessionStorage.getItem('setLanguage') !== null ? sessionStorage.getItem('setLanguage') : 'English', this.healthIDValue,