change structure socket and add permission

This commit is contained in:
AmirHossein Mahmoodi
2025-05-07 10:23:21 +03:30
parent e48e48d6bb
commit bc59952f7b
5 changed files with 21 additions and 18 deletions

View File

@@ -92,6 +92,16 @@ export const SocketProvider = ({ children }) => {
}
}, [status]);
useEffect(() => {
if (status == "connected") return;
socket.connect();
return () => {
socket.disconnect();
};
}, [socket]);
const contextValue = useMemo(() => ({ socket, status }), [socket, status]);
return (