From 81d4e7ccbbfdeb45f1fa90b41b7c8998cd4b290f Mon Sep 17 00:00:00 2001 From: Heikki Hannikainen Date: Wed, 3 Aug 2016 22:58:38 +0300 Subject: [PATCH] status: Switch to newer $http api --- src/web/aprsc.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/web/aprsc.js b/src/web/aprsc.js index c8d9d25..2e8c082 100644 --- a/src/web/aprsc.js +++ b/src/web/aprsc.js @@ -734,8 +734,10 @@ app.controller('aprscc', [ '$scope', '$http', 'graphs', 'ngDialog', function($sc 'timeout': 35000 }; - $http.get('/status.json', config).success(function(d) { - console.log('status.json received'); + $http({ method: 'GET', url: '/status.json', config: config}).then(function successCallback(r) { + console.log('status.json received: ' + r.status); + + var d = r.data; if ($scope.status) { d.tick_dif = d.server.tick_now - $scope.status.server.tick_now; @@ -748,8 +750,9 @@ app.controller('aprscc', [ '$scope', '$http', 'graphs', 'ngDialog', function($sc $scope.status = d; setTimeout(function() { full_load($scope, $http); }, 10000); - }).error(function(data, status, headers, config) { - console.log('HTTP update failed, status: ' + status); + }, function errorCallback(r) { + console.log('HTTP status.json fetch failed: ' + r.status); + setTimeout(function() { full_load($scope, $http); }, 10000); }); };