Skip to content

Commit

Permalink
Handle edge case where wifi comes on/off
Browse files Browse the repository at this point in the history
  • Loading branch information
galeaspablo committed Mar 15, 2024
1 parent 502d648 commit 5d4b7f0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
3 changes: 2 additions & 1 deletion frontend/static/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,13 @@ async function fetchEvents(url) {
try {
const response = await fetch(url);
if (!response.ok) {
return null;
return [];
}
return await response.json();
} catch (error) {
console.error('Error fetching events:', error);
}
return [];
}

function viewTitle({ title, refreshing, countdown, autoRefresh, currentPage }) {
Expand Down
6 changes: 5 additions & 1 deletion frontend/static/ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,11 @@ function init(root, initialState, update, view) {
queue = [];

msgs.forEach(msg => {
state = update(state, msg, enqueue);
try {
state = update(state, msg, enqueue);
} catch (e) {
console.error(e);
}
});

draw();
Expand Down

0 comments on commit 5d4b7f0

Please sign in to comment.