feat: use SSE reconnect to prevent API Key modal to pop up in dashboard if no API Key is configured
This commit is contained in:
parent
497c87b02e
commit
75d204e7f3
1 changed files with 7 additions and 5 deletions
|
|
@ -1171,11 +1171,13 @@ function renderTimeSeriesChart(timeSeriesData, chart, minutes) {
|
|||
}
|
||||
};
|
||||
|
||||
source.onerror = async (err) => {
|
||||
console.error("SSE connection error. Retrying...", err);
|
||||
source.close();
|
||||
await showApiKeyModal("Enter the NOMYO Router API key to view live usage.");
|
||||
loadUsage();
|
||||
source.onerror = (err) => {
|
||||
// EventSource auto-reconnects on transient drops as long as we
|
||||
// don't close it. Don't treat a dropped stream as an auth failure:
|
||||
// auth prompting is handled by loadEndpoints()/authedFetch() on the
|
||||
// REST endpoints. A genuine 401 closes the stream permanently here
|
||||
// (no reconnect loop), and the REST path surfaces the modal.
|
||||
console.error("SSE connection error; awaiting auto-reconnect.", err);
|
||||
};
|
||||
window.addEventListener("beforeunload", () => source.close());
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue