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,