This commit is contained in:
parent
edbd2eef24
commit
d7eaf1584d
|
|
@ -10,7 +10,7 @@ import Meeting from '@/page/Meeting/index'
|
|||
import NotFound from '@/page/NotFound/index'
|
||||
import { storage } from '@/utils'
|
||||
import { Spin } from "antd";
|
||||
import { onSignalr, offSignalr } from "@/utils/package/signalr";
|
||||
import { onInvitation } from "@/utils/package/signalr";
|
||||
import JoinMeetingModal from "./components/JoinMeetingModal";
|
||||
|
||||
const App: React.FC = () => {
|
||||
|
|
@ -61,7 +61,7 @@ const App: React.FC = () => {
|
|||
};
|
||||
}, []);
|
||||
useEffect(() => {
|
||||
onSignalr((item: any) => {
|
||||
onInvitation((item: any) => {
|
||||
switch (item.key) {
|
||||
case 'Invitation':
|
||||
window.electron.joinNotification({
|
||||
|
|
@ -72,9 +72,6 @@ const App: React.FC = () => {
|
|||
break;
|
||||
}
|
||||
})
|
||||
return () => {
|
||||
offSignalr()
|
||||
}
|
||||
}, [])
|
||||
const handleResize = (): void => {
|
||||
setWindowSize({
|
||||
|
|
|
|||
|
|
@ -16,6 +16,14 @@ export const startSignalr = () => {
|
|||
.catch((err: any) => console.error('Error while establishing connection: ', err));
|
||||
}
|
||||
|
||||
export const onInvitation = (callBack: Function) => {
|
||||
connection.on("Invitation", (roomNum: string, roomName: string, InviterName: string) => {
|
||||
callBack({
|
||||
key: 'Invitation',
|
||||
roomNum, roomName, InviterName
|
||||
})
|
||||
});
|
||||
}
|
||||
export const onSignalr = (callBack: Function) => {
|
||||
if (connection) {
|
||||
connection.on("ReceiveMessage", (uid: string, userName: string, message: string) => {
|
||||
|
|
@ -46,12 +54,6 @@ export const onSignalr = (callBack: Function) => {
|
|||
type
|
||||
})
|
||||
});
|
||||
connection.on("Invitation", (roomNum: string, roomName: string, InviterName: string) => {
|
||||
callBack({
|
||||
key: 'Invitation',
|
||||
roomNum, roomName, InviterName
|
||||
})
|
||||
});
|
||||
}
|
||||
}
|
||||
export const offSignalr = () => {
|
||||
|
|
@ -60,7 +62,6 @@ export const offSignalr = () => {
|
|||
connection.off('RefreshUserList');
|
||||
connection.off('Operation');
|
||||
connection.off('ForceExitRoom');
|
||||
connection.off('Invitation');
|
||||
}
|
||||
}
|
||||
export const onInvoke = async (str: string, data: any) => {
|
||||
|
|
|
|||
Loading…
Reference in New Issue