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