CFE-11 change transport protocol socket and fixed bug toast container connection
This commit is contained in:
@@ -2,7 +2,7 @@ import {createContext, useEffect, useMemo, useRef, useState} from "react";
|
||||
import {io} from "socket.io-client";
|
||||
import useUser from "@/lib/app/hooks/useUser";
|
||||
import {useTranslations} from "next-intl";
|
||||
import {toast, ToastContainer} from "react-toastify";
|
||||
import {toast} from "react-toastify";
|
||||
import PowerIcon from "@mui/icons-material/Power";
|
||||
import PowerOffIcon from "@mui/icons-material/PowerOff";
|
||||
import useDirection from "@/lib/app/hooks/useDirection";
|
||||
@@ -17,7 +17,7 @@ export const SocketProvider = ({children}) => {
|
||||
const {directionApp} = useDirection();
|
||||
const socket = useMemo(() => io(process.env.NEXT_PUBLIC_SERVER_SOCKET_URL, {
|
||||
autoConnect: false,
|
||||
transports: ['websocket'],
|
||||
// transports: ['websocket'],
|
||||
auth: {
|
||||
token: ""
|
||||
}
|
||||
@@ -60,7 +60,7 @@ export const SocketProvider = ({children}) => {
|
||||
return
|
||||
}
|
||||
socketToastId.current = toast.warn(t('socket_is_not_connect_message'), {
|
||||
containerId: 'socket',
|
||||
containerId: 'connection',
|
||||
draggable: false,
|
||||
autoClose: false, closeButton: false, closeOnClick: false, icon: <PowerOffIcon/>
|
||||
})
|
||||
@@ -69,10 +69,6 @@ export const SocketProvider = ({children}) => {
|
||||
|
||||
return (
|
||||
<SocketContext.Provider value={{socket}}>
|
||||
<ToastContainer
|
||||
enableMultiContainer containerId={'socket'}
|
||||
position={directionApp === "ltr" ? "top-right" : "top-left"}
|
||||
rtl={directionApp === 'rtl'}/>
|
||||
{children}
|
||||
</SocketContext.Provider>
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user