added auto Disconnect for dispatcher

This commit is contained in:
PxlLoewe
2025-06-03 23:20:20 -07:00
parent 2da27298bc
commit 5cd5d2c337

View File

@@ -49,6 +49,13 @@ export const ConnectionBtn = () => {
};
}, [form.logoffTime, connection.connectedDispatcher]);
useEffect(() => {
// Disconnect the socket when the component unmounts
return () => {
connection.disconnect();
};
}, [connection.disconnect]);
return (
<div className="rounded-box bg-base-200 flex justify-center items-center gap-2 p-1">
{connection.message.length > 0 && (