Fix jwt-token

This commit is contained in:
2025-09-06 15:22:05 +02:00
parent e06c09fbaf
commit 215b06b5c1
9 changed files with 42 additions and 6 deletions

View File

@@ -2,6 +2,7 @@ import React, { createContext, useContext, useEffect, useState } from 'react';
import { io } from 'socket.io-client';
import { useAuth } from './AuthContext';
import toast from 'react-hot-toast';
import APP_CONFIG from '../config/app';
const SocketContext = createContext();
@@ -121,10 +122,10 @@ export const SocketProvider = ({ children }) => {
useEffect(() => {
if (isAuthenticated) {
// Initialize socket connection
const newSocket = io(process.env.NODE_ENV === 'production'
const newSocket = io(APP_CONFIG.isProduction
? window.location.origin
: 'http://localhost:3001', {
path: process.env.NODE_ENV === 'production' ? '/drones/socket.io/' : '/socket.io/'
path: APP_CONFIG.isProduction ? `${APP_CONFIG.basePath}/socket.io/` : '/socket.io/'
});
newSocket.on('connect', () => {