Skip to content

Commit

Permalink
Improve getUserData error when user not logged_in
Browse files Browse the repository at this point in the history
  • Loading branch information
xaun committed Nov 1, 2016
1 parent b1e3554 commit 45c411e
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions workspace/app/services/dev-user.svc.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
);
};
Expand Down

0 comments on commit 45c411e

Please sign in to comment.