admin: Use relative path to call API

This commit is contained in:
nemunaire 2021-07-21 23:17:47 +02:00
parent 8f1b44e3dd
commit 29607981e4
5 changed files with 87 additions and 87 deletions

View file

@ -12,7 +12,7 @@ angular.module("FICApp", ["ngSanitize", "ngAnimate"])
ev.since = now - ev.time;
});
$http.get("/events.json").then(function(response) {
$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()["last-modified"])
return;
@ -90,7 +90,7 @@ angular.module("FICApp", ["ngSanitize", "ngAnimate"])
var refreshSceneInterval = $interval(refreshScene, 900);
var refreshSettings = function() {
$http.get("/settings.json").then(function(response) {
$http.get("../settings.json").then(function(response) {
$rootScope.recvTime(response);
response.data.start = new Date(response.data.start);
response.data.end = new Date(response.data.end);
@ -104,14 +104,14 @@ angular.module("FICApp", ["ngSanitize", "ngAnimate"])
$rootScope.refresh = function() {
$http.get("/my.json").then(function(response) {
$http.get("../my.json").then(function(response) {
if ($scope.lastmyetag != undefined && $scope.lastmyetag == response.headers()["last-modified"])
return;
$scope.lastmyetag = response.headers()["last-modified"];
$scope.my = response.data;
});
$http.get("/settings.json").then(function(response) {
$http.get("../settings.json").then(function(response) {
$rootScope.recvTime(response);
response.data.start = new Date(response.data.start);
response.data.end = new Date(response.data.end);
@ -119,7 +119,7 @@ angular.module("FICApp", ["ngSanitize", "ngAnimate"])
response.data.awards = new Date("2019-01-23T15:00:00Z");
$rootScope.settings = response.data;
});
$http.get("/themes.json").then(function(response) {
$http.get("../themes.json").then(function(response) {
if ($scope.lastthemeetag != undefined && $scope.lastthemeetag == response.headers()["last-modified"])
return;
$scope.lastthemeetag = response.headers()["last-modified"];
@ -139,7 +139,7 @@ angular.module("FICApp", ["ngSanitize", "ngAnimate"])
$scope.max_gain += theme.gain;
}, themes);
});
$http.get("/teams.json").then(function(response) {
$http.get("../teams.json").then(function(response) {
if ($scope.lastteametag != undefined && $scope.lastteametag == response.headers()["last-modified"])
return;
$scope.lastteametag = response.headers()["last-modified"];
@ -165,7 +165,7 @@ angular.module("FICApp", ["ngSanitize", "ngAnimate"])
})
.controller("TeamController", function($scope, $http, $interval) {
$scope.mystats = null;
$http.get("/api/teams/" + $scope.team.id + "/stats.json").then(function(response) {
$http.get("../api/teams/" + $scope.team.id + "/stats.json").then(function(response) {
$scope.mystats = response.data;
});
})
@ -191,7 +191,7 @@ angular.module("FICApp", ["ngSanitize", "ngAnimate"])
$scope.s.params.teams.forEach(function (teamid) {
var deferred = $q.defer();
loopPromises.push(deferred.promise);
d3.json("api/teams/" + teamid + "/score-grid.json", function (rows) {
d3.json("../api/teams/" + teamid + "/score-grid.json", function (rows) {
if (rows == null) return;
rows.sort(function (a,b) { return a.time > b.time ? 1 : -1 })
var nrows = {};