From 18ccb8ec0396c7a4ec65d5a908c55cc28fead195 Mon Sep 17 00:00:00 2001 From: Dileesha Rajapakse Date: Tue, 18 Jul 2017 10:28:35 +0530 Subject: [PATCH] Refactored device.js --- .../devicemgt/app/modules/business-controllers/device.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/business-controllers/device.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/business-controllers/device.js index 308c6b7c80..6c67dfa4f2 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/business-controllers/device.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/business-controllers/device.js @@ -263,7 +263,9 @@ deviceModule = function () { url, function (responsePayload) { if(!responsePayload["responseText"]){ log.error("Error while fetching device count. API `" + url + "` returns HTTP: " + responsePayload["status"]); - throw constants["ERRORS"]["UNKNOWN_ERROR"]; + userModule.logout(function () { + response.sendRedirect(devicemgtProps["appContext"] + "login"); + }); } return parse(responsePayload["responseText"])["count"]; }, @@ -304,7 +306,9 @@ deviceModule = function () { ); } else { log.error("User object was not found in the session"); - throw constants["ERRORS"]["USER_NOT_FOUND"]; + userModule.logout(function () { + response.sendRedirect(devicemgtProps["appContext"] + "login"); + }); } };