From d1e0ec31e6bdac438d2f4c70e6cf12d7e7871c78 Mon Sep 17 00:00:00 2001 From: aamir-csol Date: Thu, 9 Apr 2026 08:36:36 +0300 Subject: [PATCH] radiology ai lab analysis & lab ai analysis api end points updates. --- lib/core/app_state.dart | 14 ++++++++++++++ .../authentication/authentication_repo.dart | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/lib/core/app_state.dart b/lib/core/app_state.dart index a5a8d72a..d02aa946 100644 --- a/lib/core/app_state.dart +++ b/lib/core/app_state.dart @@ -249,4 +249,18 @@ class AppState { _userSwitchPayloads.clear(); _childSwitchCounter = 0; } + + void clearChildUsersKeepSuperUser() { + // Keep the super user payload + final superUserPayload = _userSwitchPayloads['superUser']; + + // Clear all payloads + _userSwitchPayloads.clear(); + _childSwitchCounter = 0; + + // Restore super user if it existed + if (superUserPayload != null) { + _userSwitchPayloads['superUser'] = superUserPayload; + } + } } diff --git a/lib/features/authentication/authentication_repo.dart b/lib/features/authentication/authentication_repo.dart index 39d8e3ee..c355819e 100644 --- a/lib/features/authentication/authentication_repo.dart +++ b/lib/features/authentication/authentication_repo.dart @@ -314,7 +314,7 @@ class AuthenticationRepoImp implements AuthenticationRepo { requestBody['PatientIdentificationID'] = ""; requestBody.removeWhere((key, value) => ['NationalID', 'isDentalAllowedBackend', 'ForRegisteration'].contains(key)); appState.setIsChildLoggedIn = false; - appState.clearUserSwitchPayloads(); + appState.clearChildUsersKeepSuperUser(); } } else { appState.setIsChildLoggedIn = true;