fix issues for websocket merge
							parent
							
								
									1f8d5eb29b
								
							
						
					
					
						commit
						0a031bd9a8
					
				| 
						 | 
				
			
			@ -59,14 +59,14 @@ export const initIO = (httpServer: Server): SocketIO => {
 | 
			
		|||
 | 
			
		||||
  io = new SocketIO(httpServer, {
 | 
			
		||||
    cors: {
 | 
			
		||||
      origin: "*",
 | 
			
		||||
      allowedHeaders: ["my-custom-header"],
 | 
			
		||||
      credentials: true
 | 
			
		||||
      origin: process.env.FRONTEND_URL,
 | 
			
		||||
      //allowedHeaders: ["my-custom-header"],
 | 
			
		||||
      //credentials: true
 | 
			
		||||
    },
 | 
			
		||||
    maxHttpBufferSize: 1e8,
 | 
			
		||||
    pingInterval: 25000,
 | 
			
		||||
    pingTimeout: 60000,
 | 
			
		||||
    adapter: createAdapter(pubClient, subClient)
 | 
			
		||||
    // pingInterval: 25000,
 | 
			
		||||
    // pingTimeout: 60000,
 | 
			
		||||
    // adapter: createAdapter(pubClient, subClient)
 | 
			
		||||
  }); 
 | 
			
		||||
 
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -6,4 +6,4 @@ app.use(express.static(path.join(__dirname, "build")));
 | 
			
		|||
app.get("/*", function (req, res) {
 | 
			
		||||
	res.sendFile(path.join(__dirname, "build", "index.html"));
 | 
			
		||||
});
 | 
			
		||||
app.listen(3331);
 | 
			
		||||
app.listen(3333);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -152,7 +152,7 @@ const TicketsManager = () => {
 | 
			
		|||
  const [openCount, setOpenCount] = useState(0)
 | 
			
		||||
  const [pendingCount, setPendingCount] = useState(0)
 | 
			
		||||
 | 
			
		||||
  const userQueueIds = user.queues.map((q) => q.id)
 | 
			
		||||
  const userQueueIds = user?.queues?.map((q) => q?.id)
 | 
			
		||||
  const [selectedQueueIds, setSelectedQueueIds] = useState(userQueueIds || [])
 | 
			
		||||
 | 
			
		||||
  const [showContentSearch, setShowContentSearch] = useState(false)
 | 
			
		||||
| 
						 | 
				
			
			@ -177,9 +177,9 @@ const TicketsManager = () => {
 | 
			
		|||
  }, [setting])
 | 
			
		||||
 | 
			
		||||
  useEffect(() => {
 | 
			
		||||
    if (user.profile.toUpperCase() === "ADMIN" ||
 | 
			
		||||
      user.profile.toUpperCase() === "SUPERVISOR" ||
 | 
			
		||||
      user.profile.toUpperCase() === "MASTER") {
 | 
			
		||||
    if (user?.profile?.toUpperCase() === "ADMIN" ||
 | 
			
		||||
      user?.profile?.toUpperCase() === "SUPERVISOR" ||
 | 
			
		||||
      user?.profile?.toUpperCase() === "MASTER") {
 | 
			
		||||
      setShowAllTickets(true)
 | 
			
		||||
    }
 | 
			
		||||
    // eslint-disable-next-line react-hooks/exhaustive-deps
 | 
			
		||||
| 
						 | 
				
			
			@ -202,11 +202,11 @@ const TicketsManager = () => {
 | 
			
		|||
      if (tickets.length > 0) {
 | 
			
		||||
        const now = new Date()
 | 
			
		||||
        const differenceTime = tickets?.map(ticket => {
 | 
			
		||||
          const createdAt = new Date(ticket.createdAt)
 | 
			
		||||
          const createdAt = new Date(ticket?.createdAt)
 | 
			
		||||
          const difference = now - createdAt
 | 
			
		||||
          return difference
 | 
			
		||||
        })
 | 
			
		||||
        const sumDifferences = differenceTime.reduce((total, difference) => total + difference, 0)
 | 
			
		||||
        const sumDifferences = differenceTime?.reduce((total, difference) => total + difference, 0)
 | 
			
		||||
        const averageTimeMilliseconds = sumDifferences / tickets?.length
 | 
			
		||||
        let hours = Math.floor(averageTimeMilliseconds / 3600000)
 | 
			
		||||
        const minutes = Math.floor((averageTimeMilliseconds % 3600000) / 60000)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,7 +1,7 @@
 | 
			
		|||
import axios from "axios";
 | 
			
		||||
 | 
			
		||||
const api = axios.create({
 | 
			
		||||
	baseURL: process.env.REACT_APP_BACKEND_URL + "/api",
 | 
			
		||||
	baseURL: process.env.REACT_APP_BACKEND_URL,
 | 
			
		||||
	withCredentials: true,
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,11 +3,12 @@ import { io } from 'socket.io-client';
 | 
			
		|||
// "undefined" means the URL will be computed from the `window.location` object
 | 
			
		||||
const URL = process.env.REACT_APP_BACKEND_URL
 | 
			
		||||
 | 
			
		||||
export const socket = io(URL, {
 | 
			
		||||
    path: "/api-ws/socketio",
 | 
			
		||||
    withCredentials: true,
 | 
			
		||||
    extraHeaders: {
 | 
			
		||||
        "my-custom-header": "abcd"
 | 
			
		||||
    },
 | 
			
		||||
export const socket = io(URL, 
 | 
			
		||||
//{
 | 
			
		||||
//     withCredentials: true,
 | 
			
		||||
//     extraHeaders: {
 | 
			
		||||
//         "my-custom-header": "abcd"
 | 
			
		||||
//     },
 | 
			
		||||
    // transports: ['websocket',  'polling']
 | 
			
		||||
});
 | 
			
		||||
//}
 | 
			
		||||
);
 | 
			
		||||
		Loading…
	
		Reference in New Issue