diff --git a/templates/list.html b/templates/list.html
index 6d8c737..33880e7 100644
--- a/templates/list.html
+++ b/templates/list.html
@@ -68,7 +68,7 @@ a:hover{background-color:lightgray;color:black;}
@@ -85,12 +85,14 @@ for(let hour=8;hour<23;hour++){
}
let json=localStorage.getItem("{{day}}");
-if(json)displayEvents(JSON.parse(json))
+if(json)displayEvents(JSON.parse(json));
-fetch("{{day}}.json").then(r=>{
- bookBtn.innerText="Book a Space";
- return r.json()
+fetch("{{day}}.json").then(response=>{
+ bookBtn.ariaBusy="false";
+ if(!response.ok){throw new Error(response.status)}
+ return response.json()
}).then(json=>{
+ bookBtn.innerText="Book a Space";
tbody.innerHTML="";
displayEvents(json);
try{
@@ -99,6 +101,9 @@ fetch("{{day}}.json").then(r=>{
localStorage.clear();
localStorage.setItem("{{day}}",JSON.stringify(json))
}
+}).catch(error=>{
+ bookBtn.innerText="Fetch Failed";
+ console.error(error)
})
function createBox(row,length,name=null,link=null,type=null){
@@ -125,7 +130,6 @@ function createBox(row,length,name=null,link=null,type=null){
function displayEvents(json){
const filterClasses=new Set(window.location.search.substring(1).split(",").filter(Boolean));
-
for(const space in json){
const row=document.createElement("tr");
const info=json[space];