Refactor socket initialization to include organization and enhance asset event handling; remove unused console logs and improve asset data structure

This commit is contained in:
2025-03-31 19:38:23 +05:30
parent e54c9e6e0d
commit e3a85c81e5
12 changed files with 137 additions and 85 deletions

View File

@@ -5,19 +5,16 @@ import { io } from "socket.io-client";
export const useSocketStore = create<any>((set: any, get: any) => ({
socket: null,
initializeSocket: (email: any) => {
initializeSocket: (email: string, organization: string) => {
const existingSocket = get().socket;
if (existingSocket) {
return;
}
const socket = io(
`http://${process.env.REACT_APP_SERVER_SOCKET_API_BASE_URL}/`,
{
reconnection: false,
auth: { email },
}
);
const socket = io(`http://${process.env.REACT_APP_SERVER_SOCKET_API_BASE_URL}/Builder`, {
reconnection: false,
auth: { email, organization },
});
set({ socket });
},