Fix jwt-token
This commit is contained in:
@@ -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');
|
||||
|
||||
Reference in New Issue
Block a user