|
|
|
@ -28,13 +28,18 @@ function AuthApp() {
|
|
|
|
|
}, [href])
|
|
|
|
|
|
|
|
|
|
const totalNotify = useConversationStore((state) => state.totalNotify);
|
|
|
|
|
const [connectWebsocket, fetchInitialData, disconnectWebsocket ] = useConversationStore((state) => [
|
|
|
|
|
state.connectWebsocket,
|
|
|
|
|
state.fetchInitialData,
|
|
|
|
|
state.disconnectWebsocket,
|
|
|
|
|
]);
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
if (loginUser.userId > 0) {
|
|
|
|
|
useConversationStore.getState().connectWebsocket(loginUser.userId);
|
|
|
|
|
useConversationStore.getState().fetchInitialData(loginUser.userId); // userIdStr
|
|
|
|
|
connectWebsocket(loginUser.userId);
|
|
|
|
|
fetchInitialData(loginUser.userId); // userIdStr
|
|
|
|
|
}
|
|
|
|
|
return () => {
|
|
|
|
|
useConversationStore.getState().disconnectWebsocket();
|
|
|
|
|
disconnectWebsocket();
|
|
|
|
|
}
|
|
|
|
|
}, [])
|
|
|
|
|
|
|
|
|
|