From 45c411e88938ef94885ae3c498e75ce9da073cb6 Mon Sep 17 00:00:00 2001 From: Xaun Lopez Date: Tue, 1 Nov 2016 15:41:31 +0000 Subject: [PATCH] Improve getUserData error when user not logged_in --- workspace/app/services/dev-user.svc.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/workspace/app/services/dev-user.svc.js b/workspace/app/services/dev-user.svc.js index f279ec94..148da8de 100644 --- a/workspace/app/services/dev-user.svc.js +++ b/workspace/app/services/dev-user.svc.js @@ -17,18 +17,19 @@ angular.module('impacWorkspace').service('DevUser', function ($log, $http, $q, A // MnoExpress User & Organization retrieval // ------ this.getUserData = function(mnoeUrl) { + var errMsg = 'Unable to retrieve User data'; var url = mnoeUrl.host + mnoeUrl.base + '/current_user'; return $http.get(url).then( function (response) { var user = (response.data && response.data.current_user); if (!user.logged_in) { - return $q.reject(); + _self.fail(errMsg); + return $q.reject(errMsg); } return user || {}; }, function (error) { - var msg = 'Unable to retrieve Organizations'; - _self.fail(msg, error); - return $q.reject(msg); + _self.fail(errMsg, error); + return $q.reject(errMsg); } ); };