Commit 57d0b9e8 authored by Dominik Hebeler's avatar Dominik Hebeler
Browse files

do not follow redirects

parent 3249bb88
......@@ -137,7 +137,8 @@ function loadTotals(parallel) {
if (fetches.length < parallel) {
fetches.push(
fetch(
"/admin/count/count-data-total?date=" + date + "&interface=" + lang
"/admin/count/count-data-total?date=" + date + "&interface=" + lang,
{ redirect: "error" }
)
.then((response) => {
if (response.status === 302) {
......@@ -155,10 +156,8 @@ function loadTotals(parallel) {
data[days_ago]["total"] = total_requests;
})
.catch((reason) => {
if (!data[days_ago]) {
data[days_ago] = {};
}
data[days_ago]["total"] = 0;
// We are not logged in anymore
history.go();
})
);
} else {
......@@ -181,7 +180,8 @@ function loadSameTimes(parallel) {
if (fetches.length < parallel) {
fetches.push(
fetch(
"/admin/count/count-data-until?date=" + date + "&interface=" + lang
"/admin/count/count-data-until?date=" + date + "&interface=" + lang,
{ redirect: "error" }
)
.then((response) => {
if (response.status === 302) {
......
......@@ -39,15 +39,8 @@ function loadQueries() {
let url = base_url + "?since=" + encodeURI(latest_update);
fetch(url)
.then((response) => {
if (response.status === 302) {
// We are not logged in anymore
history.go();
} else {
return response.json();
}
})
fetch(url, { redirect: "error" })
.then((response) => response.json())
.then((data) => {
let latest = data.latest;
document.getElementById("queries").dataset.latest = latest;
......@@ -101,6 +94,10 @@ function loadQueries() {
}
checkRegexp();
})
.catch((reason) => {
// We are not logged in anymore
history.go();
});
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment