diff --git a/client/src/App.jsx b/client/src/App.jsx index 039c679..45c40b5 100644 --- a/client/src/App.jsx +++ b/client/src/App.jsx @@ -2,7 +2,6 @@ import React from 'react'; import { BrowserRouter as Router, Routes, Route } from 'react-router-dom'; import { Toaster } from 'react-hot-toast'; import { AuthProvider } from './contexts/AuthContext'; -import { MultiTenantAuthProvider } from './contexts/MultiTenantAuthContext'; import { SocketProvider } from './contexts/SocketContext'; import APP_CONFIG from './config/app'; import Layout from './components/Layout'; @@ -19,10 +18,9 @@ import ProtectedRoute from './components/ProtectedRoute'; function App() { return ( - - - - + + +
- ); } diff --git a/client/src/contexts/SocketContext.jsx b/client/src/contexts/SocketContext.jsx index c19a5b9..6db4d21 100644 --- a/client/src/contexts/SocketContext.jsx +++ b/client/src/contexts/SocketContext.jsx @@ -1,7 +1,6 @@ import React, { createContext, useContext, useEffect, useState } from 'react'; import { io } from 'socket.io-client'; import { useAuth } from './AuthContext'; -import { useMultiTenantAuth } from './MultiTenantAuthContext'; import toast from 'react-hot-toast'; import APP_CONFIG from '../config/app'; @@ -17,8 +16,8 @@ export const SocketProvider = ({ children }) => { const [notificationsEnabled, setNotificationsEnabled] = useState( localStorage.getItem('notificationsEnabled') !== 'false' // Default to enabled ); - const { isAuthenticated } = useAuth(); - const { state: { tenant } } = useMultiTenantAuth(); + const { isAuthenticated, user } = useAuth(); + const tenant = user?.tenant_id; // Mobile notification management const [notificationCooldown, setNotificationCooldown] = useState(new Map()); @@ -141,6 +140,8 @@ export const SocketProvider = ({ children }) => { if (tenant) { newSocket.emit('join_tenant_room', tenant); console.log(`🔒 Joined tenant room: ${tenant}`); + } else { + console.warn('⚠️ No tenant available for Socket.IO room isolation'); } toast.success('Connected to real-time updates');