added auto Disconnect for dispatcher
This commit is contained in:
@@ -49,6 +49,13 @@ export const ConnectionBtn = () => {
|
|||||||
};
|
};
|
||||||
}, [form.logoffTime, connection.connectedDispatcher]);
|
}, [form.logoffTime, connection.connectedDispatcher]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
// Disconnect the socket when the component unmounts
|
||||||
|
return () => {
|
||||||
|
connection.disconnect();
|
||||||
|
};
|
||||||
|
}, [connection.disconnect]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="rounded-box bg-base-200 flex justify-center items-center gap-2 p-1">
|
<div className="rounded-box bg-base-200 flex justify-center items-center gap-2 p-1">
|
||||||
{connection.message.length > 0 && (
|
{connection.message.length > 0 && (
|
||||||
|
|||||||
Reference in New Issue
Block a user