From 4516a6544ca8a55635011d99a32641d76a78554f Mon Sep 17 00:00:00 2001 From: Negue Date: Tue, 16 Sep 2014 19:33:16 +0200 Subject: [PATCH] change ApiUrlService.getApiUrl to ApiUrlService.get --- script/userServices.js | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/script/userServices.js b/script/userServices.js index 2a386c77b6..b60fa0a8aa 100644 --- a/script/userServices.js +++ b/script/userServices.js @@ -1,20 +1,19 @@ 'use strict'; -/** - * Services that persists and retrieves user from localStorage. - */ - angular.module('userServices', []) .service('ApiUrlService', ['API_URL', function(currentApiUrl){ this.setApiUrl = function(newUrl){ currentApiUrl = newUrl; }; - this.getApiUrl = function(){ + this.get = function(){ return currentApiUrl; }; }]) - + +/** + * Services that persists and retrieves user from localStorage. + */ .factory('User', ['$rootScope', '$http', '$location', '$window', 'STORAGE_USER_ID', 'STORAGE_SETTINGS_ID', 'MOBILE_APP', 'Notification', 'ApiUrlService', function($rootScope, $http, $location, $window, STORAGE_USER_ID, STORAGE_SETTINGS_ID, MOBILE_APP, Notification, ApiUrlService) { var authenticated = false; @@ -68,10 +67,8 @@ angular.module('userServices', []) // Save the current filters var current_filters = user.filters; - - var API_URL = ApiUrlService.getApiUrl(); - $http.post(API_URL + '/api/v2/user/batch-update', sent, {params: {data:+new Date, _v:user._v, siteVersion: $window.env && $window.env.siteVersion}}) + $http.post(ApiUrlService.get() + '/api/v2/user/batch-update', sent, {params: {data:+new Date, _v:user._v, siteVersion: $window.env && $window.env.siteVersion}}) .success(function (data, status, heacreatingders, config) { //make sure there are no pending actions to sync. If there are any it is not safe to apply model from server as we may overwrite user data. if (!queue.length) {