diff --git a/src/main/webapp/js/controllers.js b/src/main/webapp/js/controllers.js index 197f23bf..32e4fa5e 100644 --- a/src/main/webapp/js/controllers.js +++ b/src/main/webapp/js/controllers.js @@ -138,7 +138,7 @@ function($scope, $timeout, $stateParams, $window, $location, $state, $route, Cat $timeout(function refreshTree() { AnalyticsService.track(); - CategoryService.init(function() { + CategoryService.refresh(function() { $timeout(refreshTree, 30000); }, function() { $timeout(refreshTree, 30000); @@ -746,7 +746,7 @@ function($scope, $stateParams, $http, $route, $window, EntryService, SettingsSer olderThan : olderThan || $scope.timestamp, read : true }, function() { - CategoryService.init(function() { + CategoryService.refresh(function() { $scope.$emit('emitReload'); }); }); diff --git a/src/main/webapp/js/services.js b/src/main/webapp/js/services.js index 930ef053..8bbe6871 100644 --- a/src/main/webapp/js/services.js +++ b/src/main/webapp/js/services.js @@ -208,6 +208,13 @@ function($resource, $http) { callback(data); }); }; + res.refresh = function(callback) { + res.get(function(data) { + _.merge(res.subscriptions, data); + if (callback) + callback(data); + }); + }; res.init(); return res;