Skip to content

Commit

Permalink
[Fix] #93, offline message improvement (#96)
Browse files Browse the repository at this point in the history
  • Loading branch information
Type-Style authored Jul 19, 2024
1 parent 5e26a19 commit 7a55e4d
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/client/pages/Start.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,21 @@ function Start() {
setMessageObj({ isError: null, status: null, message: null });
setNextFetch(new Date().getTime() + fetchIntervalMs);
} catch (error) {
console.log("error fetching data %o", error);

if (!error.response) {
setMessageObj({ isError: true, status: 499, message: error.message || "offline" });
setNextFetch(new Date().getTime() + fetchIntervalMs);
return;
}

if (error.response.status == 403) { setLogin(false) }

setMessageObj({ isError: true, status: error.response.data.status || error.response.status, message: error.response.data.message || error.message });

clearInterval(intervalID.current); intervalID.current = null;
console.info("cleared Interval");
setNextFetch(null);
if (error.response.status == 403) { setLogin(false) }
setMessageObj({ isError: true, status: error.response.data.status || error.response.status, message: error.response.data.message || error.message });
}
};

Expand Down

0 comments on commit 7a55e4d

Please sign in to comment.