mirror of
https://github.com/nicotsx/ironmount.git
synced 2025-12-10 12:10:51 +01:00
feat: sse for volume status change
This commit is contained in:
@@ -92,6 +92,17 @@ export function useServerEvents() {
|
||||
});
|
||||
});
|
||||
|
||||
eventSource.addEventListener("volume:status_updated", (e) => {
|
||||
const data = JSON.parse(e.data) as VolumeEvent;
|
||||
console.log("[SSE] Volume status updated:", data);
|
||||
|
||||
queryClient.invalidateQueries();
|
||||
|
||||
handlersRef.current.get("volume:updated")?.forEach((handler) => {
|
||||
handler(data);
|
||||
});
|
||||
});
|
||||
|
||||
eventSource.onerror = (error) => {
|
||||
console.error("[SSE] Connection error:", error);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user