From 7a0883746c5a129a0fb63c8fc5055d58a4192d4b Mon Sep 17 00:00:00 2001 From: Negue Date: Mon, 15 Sep 2014 21:31:39 +0200 Subject: [PATCH 1/3] Use ApiUrlService in all services --- public/js/services/authServices.js | 6 ++++-- public/js/services/challengeServices.js | 6 ++++-- public/js/services/groupServices.js | 6 ++++-- public/js/services/memberServices.js | 7 +++++-- 4 files changed, 17 insertions(+), 8 deletions(-) diff --git a/public/js/services/authServices.js b/public/js/services/authServices.js index 9e55d7af32..5efd96761e 100644 --- a/public/js/services/authServices.js +++ b/public/js/services/authServices.js @@ -9,8 +9,8 @@ var facebook = {} angular.module('authServices', ['userServices']). factory('Facebook', - ['$http', '$location', 'User', 'API_URL', - function($http, $location, User, API_URL) { + ['$http', '$location', 'User', 'ApiUrlService', + function($http, $location, User, ApiUrlService) { //TODO FB.init({appId: '${section.parameters['facebook.app.id']}', status: true, cookie: true, xfbml: true}); var auth, user = User.user; @@ -29,6 +29,8 @@ factory('Facebook', email: response.email } + var API_URL = ApiUrlService.getApiUrl(); + $http.post(API_URL + '/api/v2/user/auth/facebook', data).success(function(data, status, headers, config) { User.authenticate(data.id, data.token, function(err) { if (!err) { diff --git a/public/js/services/challengeServices.js b/public/js/services/challengeServices.js index cf4adf9579..3473677cd2 100644 --- a/public/js/services/challengeServices.js +++ b/public/js/services/challengeServices.js @@ -5,8 +5,10 @@ */ angular.module('challengeServices', ['ngResource']). - factory('Challenges', ['API_URL', '$resource', 'User', '$q', 'Members', - function(API_URL, $resource, User, $q, Members) { + factory('Challenges', ['ApiUrlService', '$resource', 'User', '$q', 'Members', + function(ApiUrlService, $resource, User, $q, Members) { + var API_URL = ApiUrlService.getApiUrl(); + var Challenge = $resource(API_URL + '/api/v2/challenges/:cid', {cid:'@_id'}, { diff --git a/public/js/services/groupServices.js b/public/js/services/groupServices.js index cabb68fa9f..da1bab8f78 100644 --- a/public/js/services/groupServices.js +++ b/public/js/services/groupServices.js @@ -5,8 +5,10 @@ */ angular.module('groupServices', ['ngResource']). - factory('Groups', ['API_URL', '$resource', '$q', '$http', 'User', - function(API_URL, $resource, $q, $http, User) { + factory('Groups', ['ApiUrlService', '$resource', '$q', '$http', 'User', + function(ApiUrlService, $resource, $q, $http, User) { + var API_URL = ApiUrlService.getApiUrl(); + var Group = $resource(API_URL + '/api/v2/groups/:gid', {gid:'@_id', messageId: '@_messageId'}, { diff --git a/public/js/services/memberServices.js b/public/js/services/memberServices.js index 29384f4cab..19572d14b2 100644 --- a/public/js/services/memberServices.js +++ b/public/js/services/memberServices.js @@ -5,8 +5,11 @@ */ angular.module('memberServices', ['ngResource', 'sharedServices']). - factory('Members', ['$rootScope', 'Shared', 'API_URL', '$resource', - function($rootScope, Shared, API_URL, $resource) { + factory('Members', ['$rootScope', 'Shared', 'ApiUrlService', '$resource', + function($rootScope, Shared, ApiUrlService, $resource) { + + var API_URL = ApiUrlService.getApiUrl(); + var members = {}; var Member = $resource(API_URL + '/api/v2/members/:uid', {uid:'@_id'}); var memberServices = { From 8f468c27ff67761c151edd9f7516a1192e92aa18 Mon Sep 17 00:00:00 2001 From: Negue Date: Tue, 16 Sep 2014 20:52:32 +0200 Subject: [PATCH 2/3] use ApiUrlService instead of API_URL; fixed spacing in groupsCtrl.js --- public/js/controllers/authCtrl.js | 10 +++---- public/js/controllers/footerCtrl.js | 6 ++--- public/js/controllers/groupsCtrl.js | 39 +++++++++++++-------------- public/js/controllers/hallCtrl.js | 12 ++++----- public/js/controllers/rootCtrl.js | 6 ++--- public/js/controllers/settingsCtrl.js | 14 +++++----- public/js/controllers/tasksCtrl.js | 6 ++--- 7 files changed, 46 insertions(+), 47 deletions(-) diff --git a/public/js/controllers/authCtrl.js b/public/js/controllers/authCtrl.js index 419c122ba0..da6845bf9e 100644 --- a/public/js/controllers/authCtrl.js +++ b/public/js/controllers/authCtrl.js @@ -5,8 +5,8 @@ */ angular.module('authCtrl', []) - .controller("AuthCtrl", ['$scope', '$rootScope', 'User', '$http', '$location', '$window','API_URL', '$modal', - function($scope, $rootScope, User, $http, $location, $window, API_URL, $modal) { + .controller("AuthCtrl", ['$scope', '$rootScope', 'User', '$http', '$location', '$window','ApiUrlService', '$modal', + function($scope, $rootScope, User, $http, $location, $window, ApiUrlService, $modal) { var runAuth; var showedFacebookMessage; @@ -47,7 +47,7 @@ angular.module('authCtrl', []) if ($scope.registrationForm.$invalid) { return; } - var url = API_URL + "/api/v2/register"; + var url = ApiUrlService.get() + "/api/v2/register"; if($rootScope.selectedLanguage) url = url + '?lang=' + $rootScope.selectedLanguage.code; $http.post(url, $scope.registerVals).success(function(data, status, headers, config) { runAuth(data.id, data.apiToken); @@ -62,7 +62,7 @@ angular.module('authCtrl', []) if ($scope.useUUID) { runAuth($scope.loginUsername, $scope.loginPassword); } else { - $http.post(API_URL + "/api/v2/user/auth/local", data) + $http.post(ApiUrlService.get() + "/api/v2/user/auth/local", data) .success(function(data, status, headers, config) { runAuth(data.id, data.token); }).error(errorAlert); @@ -82,7 +82,7 @@ angular.module('authCtrl', []) }; $scope.passwordReset = function(email){ - $http.post(API_URL + '/api/v2/user/reset-password', {email:email}) + $http.post(ApiUrlService.get() + '/api/v2/user/reset-password', {email:email}) .success(function(){ alert(window.env.t('newPassSent')); }) diff --git a/public/js/controllers/footerCtrl.js b/public/js/controllers/footerCtrl.js index 30ec72c48e..3469c69bcf 100644 --- a/public/js/controllers/footerCtrl.js +++ b/public/js/controllers/footerCtrl.js @@ -1,8 +1,8 @@ "use strict"; (typeof habitrpg !== 'undefined' ? habitrpg : habitrpgStatic) - .controller("FooterCtrl", ['$scope', '$rootScope', 'User', '$http', 'Notification', 'API_URL', - function($scope, $rootScope, User, $http, Notification, API_URL) { + .controller("FooterCtrl", ['$scope', '$rootScope', 'User', '$http', 'Notification', 'ApiUrlService', + function($scope, $rootScope, User, $http, Notification, ApiUrlService) { if(typeof habitrpg === "undefined"){ $scope.languages = env.avalaibleLanguages; @@ -66,7 +66,7 @@ Notification.text('-1 day, remember to refresh'); } $scope.addTenGems = function(){ - $http.post(API_URL + '/api/v2/user/addTenGems').success(function(){ + $http.post(ApiUrlService.get() + '/api/v2/user/addTenGems').success(function(){ User.log({}); }) } diff --git a/public/js/controllers/groupsCtrl.js b/public/js/controllers/groupsCtrl.js index 8d723ce055..09027a603b 100644 --- a/public/js/controllers/groupsCtrl.js +++ b/public/js/controllers/groupsCtrl.js @@ -1,25 +1,24 @@ "use strict"; -habitrpg.controller("GroupsCtrl", ['$scope', '$rootScope', 'Shared', 'Groups', '$http', 'API_URL', '$q', 'User', 'Members', '$state', - function($scope, $rootScope, Shared, Groups, $http, API_URL, $q, User, Members, $state) { +habitrpg.controller("GroupsCtrl", ['$scope', '$rootScope', 'Shared', 'Groups', '$http', '$q', 'User', 'Members', '$state', + function($scope, $rootScope, Shared, Groups, $http, $q, User, Members, $state) { + $scope.isMemberOfPendingQuest = function(userid, group) { + if (!group.quest || !group.quest.members) return false; + if (group.quest.active) return false; // quest is started, not pending + return userid in group.quest.members && group.quest.members[userid] != false; + } - $scope.isMemberOfPendingQuest = function(userid, group){ - if (!group.quest || !group.quest.members) return false; - if (group.quest.active) return false; // quest is started, not pending - return userid in group.quest.members && group.quest.members[userid] != false; - } + $scope.isMemberOfRunningQuest = function(userid, group) { + if (!group.quest || !group.quest.members) return false; + if (!group.quest.active) return false; // quest is pending, not started + return group.quest.members[userid]; + } - $scope.isMemberOfRunningQuest = function(userid, group){ - if (!group.quest || !group.quest.members) return false; - if (!group.quest.active) return false; // quest is pending, not started - return group.quest.members[userid]; - } - - $scope.isMemberOfGroup = function(userid, group){ - if (!group.members) return false; - var memberIds = _.map(group.members, function(x){return x._id}); - return ~(memberIds.indexOf(userid)); - } + $scope.isMemberOfGroup = function(userid, group){ + if (!group.members) return false; + var memberIds = _.map(group.members, function(x){return x._id}); + return ~(memberIds.indexOf(userid)); + } $scope.isMember = function(user, group){ return ~(group.members.indexOf(user._id)); @@ -145,7 +144,7 @@ habitrpg.controller("GroupsCtrl", ['$scope', '$rootScope', 'Shared', 'Groups', ' }); }]) - .controller('ChatCtrl', ['$scope', 'Groups', 'User', '$http', 'API_URL', 'Notification', function($scope, Groups, User, $http, API_URL, Notification){ + .controller('ChatCtrl', ['$scope', 'Groups', 'User', '$http', 'ApiUrlService', 'Notification', function($scope, Groups, User, $http, ApiUrlService, Notification){ $scope.message = {content:''}; $scope._sending = false; @@ -207,7 +206,7 @@ habitrpg.controller("GroupsCtrl", ['$scope', '$rootScope', 'Shared', 'Groups', ' } //Chat.Chat.like({gid:group._id,mid:message.id}); - $http.post(API_URL + '/api/v2/groups/' + group._id + '/chat/' + message.id + '/like'); + $http.post(ApiUrlService.get() + '/api/v2/groups/' + group._id + '/chat/' + message.id + '/like'); } $scope.sync = function(group){ diff --git a/public/js/controllers/hallCtrl.js b/public/js/controllers/hallCtrl.js index 2223bb1078..83ce8269e9 100644 --- a/public/js/controllers/hallCtrl.js +++ b/public/js/controllers/hallCtrl.js @@ -1,8 +1,8 @@ "use strict"; -habitrpg.controller("HallHeroesCtrl", ['$scope', '$rootScope', 'User', 'Notification', 'API_URL', '$resource', - function($scope, $rootScope, User, Notification, API_URL, $resource) { - var Hero = $resource(API_URL + '/api/v2/hall/heroes/:uid', {uid:'@_id'}); +habitrpg.controller("HallHeroesCtrl", ['$scope', '$rootScope', 'User', 'Notification', 'ApiUrlService', '$resource', + function($scope, $rootScope, User, Notification, ApiUrlService, $resource) { + var Hero = $resource(ApiUrlService.get() + '/api/v2/hall/heroes/:uid', {uid:'@_id'}); $scope.hero = undefined; $scope.loadHero = function(uuid){ $scope.hero = Hero.get({uid:uuid}); @@ -18,9 +18,9 @@ habitrpg.controller("HallHeroesCtrl", ['$scope', '$rootScope', 'User', 'Notifica $scope.heroes = Hero.query(); }]); -habitrpg.controller("HallPatronsCtrl", ['$scope', '$rootScope', 'User', 'Notification', 'API_URL', '$resource', - function($scope, $rootScope, User, Notification, API_URL, $resource) { - var Patron = $resource(API_URL + '/api/v2/hall/patrons/:uid', {uid:'@_id'}); +habitrpg.controller("HallPatronsCtrl", ['$scope', '$rootScope', 'User', 'Notification', 'ApiUrlService', '$resource', + function($scope, $rootScope, User, Notification, ApiUrlService, $resource) { + var Patron = $resource(ApiUrlService.get() + '/api/v2/hall/patrons/:uid', {uid:'@_id'}); var page = 0; $scope.patrons = []; diff --git a/public/js/controllers/rootCtrl.js b/public/js/controllers/rootCtrl.js index cee9f992de..6a74b7f806 100644 --- a/public/js/controllers/rootCtrl.js +++ b/public/js/controllers/rootCtrl.js @@ -3,8 +3,8 @@ /* Make user and settings available for everyone through root scope. */ -habitrpg.controller("RootCtrl", ['$scope', '$rootScope', '$location', 'User', '$http', '$state', '$stateParams', 'Notification', 'Groups', 'Shared', 'Content', '$modal', '$timeout', - function($scope, $rootScope, $location, User, $http, $state, $stateParams, Notification, Groups, Shared, Content, $modal, $timeout) { +habitrpg.controller("RootCtrl", ['$scope', '$rootScope', '$location', 'User', '$http', '$state', '$stateParams', 'Notification', 'Groups', 'Shared', 'Content', '$modal', '$timeout', 'ApiUrlService' + function($scope, $rootScope, $location, User, $http, $state, $stateParams, Notification, Groups, Shared, Content, $modal, $timeout, ApiUrlService) { var user = User.user; var initSticky = _.once(function(){ @@ -235,7 +235,7 @@ habitrpg.controller("RootCtrl", ['$scope', '$rootScope', '$location', 'User', '$ $scope.spell = null; $rootScope.applyingAction = false; - $http.post('/api/v2/user/class/cast/'+spell.key+'?targetType='+type+'&targetId='+targetId) + $http.post(ApiUrlService.get() + '/api/v2/user/class/cast/'+spell.key+'?targetType='+type+'&targetId='+targetId) .success(function(){ var msg = window.env.t('youCast', {spell: spell.text()}); switch (type) { diff --git a/public/js/controllers/settingsCtrl.js b/public/js/controllers/settingsCtrl.js index a6c401d179..087cedc91e 100644 --- a/public/js/controllers/settingsCtrl.js +++ b/public/js/controllers/settingsCtrl.js @@ -2,8 +2,8 @@ // Make user and settings available for everyone through root scope. habitrpg.controller('SettingsCtrl', - ['$scope', 'User', '$rootScope', '$http', 'API_URL', 'Guide', '$location', '$timeout', 'Notification', - function($scope, User, $rootScope, $http, API_URL, Guide, $location, $timeout, Notification) { + ['$scope', 'User', '$rootScope', '$http', 'ApiUrlService', 'Guide', '$location', '$timeout', 'Notification', + function($scope, User, $rootScope, $http, ApiUrlService, Guide, $location, $timeout, Notification) { // FIXME we have this re-declared everywhere, figure which is the canonical version and delete the rest // $scope.auth = function (id, token) { @@ -79,7 +79,7 @@ habitrpg.controller('SettingsCtrl', if (!changeUser.newUsername || !changeUser.password) { return alert(window.env.t('fillAll')); } - $http.post(API_URL + '/api/v2/user/change-username', changeUser) + $http.post(ApiUrlService.get() + '/api/v2/user/change-username', changeUser) .success(function(){ alert(window.env.t('usernameSuccess')); $scope.changeUser = {}; @@ -93,7 +93,7 @@ habitrpg.controller('SettingsCtrl', if (!changePass.oldPassword || !changePass.newPassword || !changePass.confirmNewPassword) { return alert(window.env.t('fillAll')); } - $http.post(API_URL + '/api/v2/user/change-password', changePass) + $http.post(ApiUrlService.get() + '/api/v2/user/change-password', changePass) .success(function(data, status, headers, config){ if (data.err) return alert(data.err); alert(window.env.t('passSuccess')); @@ -130,7 +130,7 @@ habitrpg.controller('SettingsCtrl', } $scope['delete'] = function(){ - $http['delete'](API_URL + '/api/v2/user') + $http['delete'](ApiUrlService.get() + '/api/v2/user') .success(function(res, code){ if (res.err) return alert(res.err); localStorage.clear(); @@ -139,14 +139,14 @@ habitrpg.controller('SettingsCtrl', } $scope.enterCoupon = function(code) { - $http.post(API_URL + '/api/v2/user/coupon/' + code).success(function(res,code){ + $http.post(ApiUrlService.get() + '/api/v2/user/coupon/' + code).success(function(res,code){ if (code!==200) return; User.sync(); Notification.text('Coupon applied! Check your inventory'); }); } $scope.generateCodes = function(codes){ - $http.post(API_URL + '/api/v2/coupons/generate/'+codes.event+'?count='+(codes.count || 1)) + $http.post(ApiUrlService.get() + '/api/v2/coupons/generate/'+codes.event+'?count='+(codes.count || 1)) .success(function(res,code){ $scope._codes = {}; if (code!==200) return; diff --git a/public/js/controllers/tasksCtrl.js b/public/js/controllers/tasksCtrl.js index 7a5ad38d80..58c5a6bae7 100644 --- a/public/js/controllers/tasksCtrl.js +++ b/public/js/controllers/tasksCtrl.js @@ -1,7 +1,7 @@ "use strict"; -habitrpg.controller("TasksCtrl", ['$scope', '$rootScope', '$location', 'User','Notification', '$http', 'API_URL', '$timeout', 'Shared', - function($scope, $rootScope, $location, User, Notification, $http, API_URL, $timeout, Shared) { +habitrpg.controller("TasksCtrl", ['$scope', '$rootScope', '$location', 'User','Notification', '$http', 'ApiUrlService', '$timeout', 'Shared', + function($scope, $rootScope, $location, User, Notification, $http, ApiUrlService, $timeout, Shared) { $scope.obj = User.user; // used for task-lists $scope.user = User.user; @@ -86,7 +86,7 @@ habitrpg.controller("TasksCtrl", ['$scope', '$rootScope', '$location', 'User','N $scope.unlink = function(task, keep) { // TODO move this to userServices, turn userSerivces.user into ng-resource - $http.post(API_URL + '/api/v2/user/tasks/' + task.id + '/unlink?keep=' + keep) + $http.post(ApiUrlService.get() + '/api/v2/user/tasks/' + task.id + '/unlink?keep=' + keep) .success(function(){ User.log({}); }); From e180f73a0e2912a946defe9d9c322b414e4e0d98 Mon Sep 17 00:00:00 2001 From: Negue Date: Wed, 17 Sep 2014 20:35:44 +0200 Subject: [PATCH 3/3] apiUrlService inside services --- public/js/services/authServices.js | 4 +--- public/js/services/challengeServices.js | 12 +++++------- public/js/services/groupServices.js | 26 ++++++++++++------------- public/js/services/memberServices.js | 5 +---- 4 files changed, 19 insertions(+), 28 deletions(-) diff --git a/public/js/services/authServices.js b/public/js/services/authServices.js index 5efd96761e..46bfaddb0d 100644 --- a/public/js/services/authServices.js +++ b/public/js/services/authServices.js @@ -29,9 +29,7 @@ factory('Facebook', email: response.email } - var API_URL = ApiUrlService.getApiUrl(); - - $http.post(API_URL + '/api/v2/user/auth/facebook', data).success(function(data, status, headers, config) { + $http.post(ApiUrlService.get() + '/api/v2/user/auth/facebook', data).success(function(data, status, headers, config) { User.authenticate(data.id, data.token, function(err) { if (!err) { alert(window.env.t('loginSuccess')); diff --git a/public/js/services/challengeServices.js b/public/js/services/challengeServices.js index 3473677cd2..0b1d39eaf8 100644 --- a/public/js/services/challengeServices.js +++ b/public/js/services/challengeServices.js @@ -7,16 +7,14 @@ angular.module('challengeServices', ['ngResource']). factory('Challenges', ['ApiUrlService', '$resource', 'User', '$q', 'Members', function(ApiUrlService, $resource, User, $q, Members) { - var API_URL = ApiUrlService.getApiUrl(); - - var Challenge = $resource(API_URL + '/api/v2/challenges/:cid', + var Challenge = $resource(ApiUrlService.get() + '/api/v2/challenges/:cid', {cid:'@_id'}, { //'query': {method: "GET", isArray:false} - join: {method: "POST", url: API_URL + '/api/v2/challenges/:cid/join'}, - leave: {method: "POST", url: API_URL + '/api/v2/challenges/:cid/leave'}, - close: {method: "POST", params: {uid:''}, url: API_URL + '/api/v2/challenges/:cid/close'}, - getMember: {method: "GET", url: API_URL + '/api/v2/challenges/:cid/member/:uid'} + join: {method: "POST", url: ApiUrlService.get() + '/api/v2/challenges/:cid/join'}, + leave: {method: "POST", url: ApiUrlService.get() + '/api/v2/challenges/:cid/leave'}, + close: {method: "POST", params: {uid:''}, url: ApiUrlService.get() + '/api/v2/challenges/:cid/close'}, + getMember: {method: "GET", url: ApiUrlService.get() + '/api/v2/challenges/:cid/member/:uid'} }); //var challenges = []; diff --git a/public/js/services/groupServices.js b/public/js/services/groupServices.js index da1bab8f78..42dd787846 100644 --- a/public/js/services/groupServices.js +++ b/public/js/services/groupServices.js @@ -7,22 +7,20 @@ angular.module('groupServices', ['ngResource']). factory('Groups', ['ApiUrlService', '$resource', '$q', '$http', 'User', function(ApiUrlService, $resource, $q, $http, User) { - var API_URL = ApiUrlService.getApiUrl(); - - var Group = $resource(API_URL + '/api/v2/groups/:gid', + var Group = $resource(ApiUrlService.get() + '/api/v2/groups/:gid', {gid:'@_id', messageId: '@_messageId'}, { //query: {method: "GET", isArray:false}, - postChat: {method: "POST", url: API_URL + '/api/v2/groups/:gid/chat'}, - deleteChatMessage: {method: "DELETE", url: API_URL + '/api/v2/groups/:gid/chat/:messageId'}, - join: {method: "POST", url: API_URL + '/api/v2/groups/:gid/join'}, - leave: {method: "POST", url: API_URL + '/api/v2/groups/:gid/leave'}, - invite: {method: "POST", url: API_URL + '/api/v2/groups/:gid/invite'}, - removeMember: {method: "POST", url: API_URL + '/api/v2/groups/:gid/removeMember'}, - questAccept: {method: "POST", url: API_URL + '/api/v2/groups/:gid/questAccept'}, - questReject: {method: "POST", url: API_URL + '/api/v2/groups/:gid/questReject'}, - questCancel: {method: "POST", url: API_URL + '/api/v2/groups/:gid/questCancel'}, - questAbort: {method: "POST", url: API_URL + '/api/v2/groups/:gid/questAbort'} + postChat: {method: "POST", url: ApiUrlService.get() + '/api/v2/groups/:gid/chat'}, + deleteChatMessage: {method: "DELETE", url: ApiUrlService.get() + '/api/v2/groups/:gid/chat/:messageId'}, + join: {method: "POST", url: ApiUrlService.get() + '/api/v2/groups/:gid/join'}, + leave: {method: "POST", url: ApiUrlService.get() + '/api/v2/groups/:gid/leave'}, + invite: {method: "POST", url: ApiUrlService.get() + '/api/v2/groups/:gid/invite'}, + removeMember: {method: "POST", url: ApiUrlService.get() + '/api/v2/groups/:gid/removeMember'}, + questAccept: {method: "POST", url: ApiUrlService.get() + '/api/v2/groups/:gid/questAccept'}, + questReject: {method: "POST", url: ApiUrlService.get() + '/api/v2/groups/:gid/questReject'}, + questCancel: {method: "POST", url: ApiUrlService.get() + '/api/v2/groups/:gid/questCancel'}, + questAbort: {method: "POST", url: ApiUrlService.get() + '/api/v2/groups/:gid/questAbort'} }); // Defer loading everything until they're requested @@ -49,7 +47,7 @@ angular.module('groupServices', ['ngResource']). // On enter, set chat message to "seen" seenMessage: function(gid){ - $http.post('/api/v2/groups/'+gid+'/chat/seen'); + $http.post(ApiUrlService.get() + '/api/v2/groups/'+gid+'/chat/seen'); if (User.user.newMessages) delete User.user.newMessages[gid]; }, diff --git a/public/js/services/memberServices.js b/public/js/services/memberServices.js index 19572d14b2..c24eaa5981 100644 --- a/public/js/services/memberServices.js +++ b/public/js/services/memberServices.js @@ -7,11 +7,8 @@ angular.module('memberServices', ['ngResource', 'sharedServices']). factory('Members', ['$rootScope', 'Shared', 'ApiUrlService', '$resource', function($rootScope, Shared, ApiUrlService, $resource) { - - var API_URL = ApiUrlService.getApiUrl(); - var members = {}; - var Member = $resource(API_URL + '/api/v2/members/:uid', {uid:'@_id'}); + var Member = $resource(ApiUrlService.get() + '/api/v2/members/:uid', {uid:'@_id'}); var memberServices = { Member: Member,