dashboard: use last-modified field instead of etag

This commit is contained in:
nemunaire 2018-12-04 04:13:25 +01:00
parent e9fd9c4e9a
commit 46aaa7cb4a

View File

@ -10,9 +10,9 @@ angular.module("FICApp", ["ngSanitize", "ngAnimate"])
$http.get("/events.json").then(function(response) {
// Don't make anything if the page hasn't changed
if ($scope.lasteventsetag != undefined && $scope.lasteventsetag == response.headers().etag)
if ($scope.lasteventsetag != undefined && $scope.lasteventsetag == response.headers()["last-modified"])
return;
$scope.lasteventsetag = response.headers().etag;
$scope.lasteventsetag = response.headers()["last-modified"];
var events = response.data;
@ -72,18 +72,18 @@ angular.module("FICApp", ["ngSanitize", "ngAnimate"])
pathname = "/public0.html"
var refreshScene = function() {
$http.get(pathname.replace(".html", ".json")).then(function(response) {
if ($scope.lastpublicetag != undefined && $scope.lastpublicetag == response.headers().etag)
if ($scope.lastpublicetag != undefined && $scope.lastpublicetag == response.headers()["last-modified"])
return;
$scope.lastpublicetag = response.headers().etag;
$scope.lastpublicetag = response.headers()["last-modified"];
$scope.scene = response.data;
});
}
var refreshData = function() {
$http.get("/my.json").then(function(response) {
if ($scope.lastmyetag != undefined && $scope.lastmyetag == response.headers().etag)
if ($scope.lastmyetag != undefined && $scope.lastmyetag == response.headers()["last-modified"])
return;
$scope.lastmyetag = response.headers().etag;
$scope.lastmyetag = response.headers()["last-modified"];
$scope.my = response.data;
});
@ -98,9 +98,9 @@ angular.module("FICApp", ["ngSanitize", "ngAnimate"])
$rootScope.settings = response.data;
});
$http.get("/themes.json").then(function(response) {
if ($scope.lastthemeetag != undefined && $scope.lastthemeetag == response.headers().etag)
if ($scope.lastthemeetag != undefined && $scope.lastthemeetag == response.headers()["last-modified"])
return;
$scope.lastthemeetag = response.headers().etag;
$scope.lastthemeetag = response.headers()["last-modified"];
var themes = response.data;
$scope.themes = themes;
@ -118,9 +118,9 @@ angular.module("FICApp", ["ngSanitize", "ngAnimate"])
}, themes);
});
$http.get("/teams.json").then(function(response) {
if ($scope.lastteametag != undefined && $scope.lastteametag == response.headers().etag)
if ($scope.lastteametag != undefined && $scope.lastteametag == response.headers()["last-modified"])
return;
$scope.lastteametag = response.headers().etag;
$scope.lastteametag = response.headers()["last-modified"];
var teams = response.data;