This commit is contained in:
yj 2024-08-15 10:53:35 +08:00
parent 522f7492b5
commit 92a3bb89a5
1 changed files with 28 additions and 25 deletions

View File

@ -31,6 +31,7 @@ const App: React.FC = () => {
});
const [spinning, setSpinning] = useState(false);
const [isState, setIsState] = useState(true);
const [isOnOtherSignalr, setIsOnOtherSignalr] = useState(true);
useEffect(() => {
let userInfo = JSON.parse(storage.getItem('user') as string)
let loginInfo = JSON.parse(storage.getItem('login') as string)
@ -110,30 +111,6 @@ const App: React.FC = () => {
leaveChannel()
})
}, [])
useEffect(() => {
setTimeout(() => {
onOtherSignalr(async (item: any) => {
switch (item.key) {
case 'Invitation':
window.electron.joinNotification({
body: item.roomName,
name: item.InviterName,
})
joinMeetingModalRef.current.changeModal(item)
break;
case 'ForceLogout':
if (item.message) {
message.error(item.message)
}
await leaveChannel(true)
toSrc('/login')
break;
}
})
}, 3000);
}, [])
useEffect(() => {
onReconnected(async () => {
storage.setItem('reconnect', true)
@ -180,7 +157,33 @@ const App: React.FC = () => {
}
storage.setItem('stateInfo', JSON.stringify(state))
}, [state])
useEffect(() => {
if (location.hash.indexOf('/login') !== 1) {
if (isOnOtherSignalr) {
setIsOnOtherSignalr(false)
onOtherSignalr(async (item: any) => {
switch (item.key) {
case 'Invitation':
window.electron.joinNotification({
body: item.roomName,
name: item.InviterName,
})
joinMeetingModalRef.current.changeModal(item)
break;
case 'ForceLogout':
if (item.msg) {
message.error(item.msg)
}
await leaveChannel(true)
toSrc('/login')
break;
}
})
}
} else {
setIsOnOtherSignalr(true)
}
}, [navigate])
const handleResize = (): void => {
setWindowSize({
width: window.innerWidth,