From d2650be135979491b6b2a14c9323f64071ad2d4e Mon Sep 17 00:00:00 2001 From: Rahul Ramesh <121226043+rahu1ramesh@users.noreply.github.com> Date: Fri, 19 Jul 2024 18:48:30 +0530 Subject: [PATCH] BAH-3971 | Add. Null Check For LocationCookieName Assignment (#989) --- ui/app/common/auth/authentication.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ui/app/common/auth/authentication.js b/ui/app/common/auth/authentication.js index 09df4b2f25..b00cfb71eb 100644 --- a/ui/app/common/auth/authentication.js +++ b/ui/app/common/auth/authentication.js @@ -140,7 +140,10 @@ angular.module('authentication') userService.getProviderForUser(data.results[0].uuid).then(function (providers) { if (!_.isEmpty(providers.results) && hasAnyActiveProvider(providers.results)) { $rootScope.currentUser = new Bahmni.Auth.User(data.results[0]); - $rootScope.currentUser.currentLocation = $bahmniCookieStore.get(Bahmni.Common.Constants.locationCookieName).name; + var location = $bahmniCookieStore.get(Bahmni.Common.Constants.locationCookieName); + if (location) { + $rootScope.currentUser.currentLocation = location.name; + } $rootScope.$broadcast('event:user-credentialsLoaded', data.results[0]); deferrable.resolve(data.results[0]); } else {