Skip to content

Commit 01443b0

Browse files
committed
redirect when fail to fetch request instead of onload
1 parent fb0b2f0 commit 01443b0

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

soundboxBooking.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,6 @@ const timetable = [
1717
];
1818
let selectedBlocks=[]
1919
window.onload = function() {
20-
if(document.cookie.indexOf("token=")==-1){
21-
window.location.replace("/login_page.html")
22-
}
2320
selectedBlocks=[]
2421
let today = new Date();
2522
if(today.getHours() >= 18) {
@@ -96,6 +93,7 @@ async function fetchSoundboxState(startDate) {
9693
const result = await response.json();
9794
return result;
9895
} catch (e) {
96+
window.location.replace("/login_page.html");
9997
console.error("Error fetching soundbox state:", e);
10098
return null;
10199
}

0 commit comments

Comments
 (0)