From 3fc84e532ea374590f61b29fa0e380e39b1044a7 Mon Sep 17 00:00:00 2001 From: John Donaldson Date: Mon, 28 Oct 2019 18:11:25 +0000 Subject: [PATCH] Allowing cached results for static puzzle content --- theme/moth.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/theme/moth.js b/theme/moth.js index ff17ae2..4aab5fb 100644 --- a/theme/moth.js +++ b/theme/moth.js @@ -133,7 +133,9 @@ function drawCacheButton(teamId) { } else { cacher.style.display = "none"; } - }); + }).catch( ex => { + cacher.style.display = "none"; + }) } setInterval ( updateCacheButton , 30000); @@ -156,7 +158,7 @@ async function fetchAll(teamId) { if (resource == "puzzles.json") { continue; } - fetch(resource, {headers: headers}) + fetch(resource) .then( e => { console.log("Fetched " + resource); }) @@ -179,7 +181,7 @@ async function fetchAll(teamId) { let puzzles = categories[cat_name]; for (let puzzle of puzzles) { let url = "puzzle.html?cat=" + cat_name + "&points=" + puzzle[0] + "&pid=" + puzzle[1]; - requests.push( fetch(url, {headers: headers}) + requests.push( fetch(url) .then( e => { console.log("Fetched " + url); }));