smooth untuning and listening to that event as well as firing well, although could need more involvement than this simplicity
This commit is contained in:
@@ -4,6 +4,7 @@ import {
|
|||||||
ServerResponseChannels,
|
ServerResponseChannels,
|
||||||
SomeoneConnectedResponse,
|
SomeoneConnectedResponse,
|
||||||
SomeoneTunedResponse,
|
SomeoneTunedResponse,
|
||||||
|
SomeoneUntunedFromLineResponse,
|
||||||
TuneToLineRequest,
|
TuneToLineRequest,
|
||||||
UntuneFromLineRequest,
|
UntuneFromLineRequest,
|
||||||
} from '@nirvana/core/sockets/channels';
|
} from '@nirvana/core/sockets/channels';
|
||||||
@@ -102,6 +103,22 @@ export function ConversationProvider({ children }: { children: React.ReactNode }
|
|||||||
draft[res.lineId].tunedInUsers = res.allUsers;
|
draft[res.lineId].tunedInUsers = res.allUsers;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$ws.on(
|
||||||
|
ServerResponseChannels.SOMEONE_UNTUNED_FROM_LINE,
|
||||||
|
(res: SomeoneUntunedFromLineResponse) => {
|
||||||
|
setConversationMap((draft) => {
|
||||||
|
if (!draft[res.lineId]) {
|
||||||
|
toast.error('no line');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
draft[res.lineId].tunedInUsers = draft[res.lineId].tunedInUsers.filter(
|
||||||
|
(userId) => userId !== res.userId,
|
||||||
|
);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
);
|
||||||
}, [$ws, setConversationMap]);
|
}, [$ws, setConversationMap]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|||||||
Reference in New Issue
Block a user