1
0
mirror of https://github.com/amir20/dozzle.git synced 2025-12-24 14:31:44 +01:00

fix: improves event stream error and only shows when closed

This commit is contained in:
Amir Raminfar
2023-09-27 16:33:56 -07:00
parent a9afe7a299
commit 67dbbfce97

View File

@@ -36,15 +36,17 @@ export const useContainerStore = defineStore("container", () => {
ready.value = false;
es = new EventSource(`${config.base}/api/events/stream`);
es.addEventListener("error", (e) => {
showToast(
{
id: "events-stream",
message: t("error.events-stream.message"),
title: t("error.events-stream.title"),
type: "error",
},
{ once: true },
);
if (es?.readyState === EventSource.CLOSED) {
showToast(
{
id: "events-stream",
message: t("error.events-stream.message"),
title: t("error.events-stream.title"),
type: "error",
},
{ once: true },
);
}
});
es.addEventListener("containers-changed", (e: Event) =>