From d532e8f714d1e23308006529ff45d21df62d7d8d Mon Sep 17 00:00:00 2001 From: Sneha Date: Fri, 11 Sep 2026 16:36:02 +0530 Subject: [PATCH] fix: surface activation/deactivation failures instead of reporting success OutputResponse returns HTTP 200 with statusCode 5000 on failure, and the global interceptor only special-cases 5002 (session expiry), so an API-level failure reached the success callback. Clicking Activate on a user the backend could not update showed "Activated successfully", then refreshed the list with the user still deactivated -- the failure was only ever visible in the browser console. The success callback now checks statusCode before alerting, and the error callback raises the message instead of just logging it. Co-Authored-By: Claude Opus 5 (1M context) --- .../employee-master-new.component.ts | 24 ++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/src/app/app-provider-admin/provider-admin/activities/employee-master-new/employee-master-new.component.ts b/src/app/app-provider-admin/provider-admin/activities/employee-master-new/employee-master-new.component.ts index 7fdde2a..98b30c3 100644 --- a/src/app/app-provider-admin/provider-admin/activities/employee-master-new/employee-master-new.component.ts +++ b/src/app/app-provider-admin/provider-admin/activities/employee-master-new/employee-master-new.component.ts @@ -1616,8 +1616,17 @@ export class EmployeeMasterNewComponent implements OnInit { this.employeeMasterNewService .userActivationDeactivation(obj) .subscribe( - (res) => { - console.log('Activation or deactivation response', res.data); + (res: any) => { + if (res?.statusCode !== 200) { + this.dialogService.alert( + res?.errorMessage || + 'Failed to ' + + this.confirmMessage.toLowerCase() + + ' the user', + 'error', + ); + return; + } this.dialogService.alert( this.confirmMessage + 'd successfully', 'success', @@ -1625,7 +1634,16 @@ export class EmployeeMasterNewComponent implements OnInit { this.getAllUserDetails(); this.searchTerm = null; }, - (err) => console.log('error', err), + (err: any) => { + console.log('error', err); + this.dialogService.alert( + err?.errorMessage || + 'Failed to ' + + this.confirmMessage.toLowerCase() + + ' the user', + 'error', + ); + }, ); } },