bigbluebutton-Github/bigbluebutton-html5/imports/ui/components/components-data/group-chat-context/adapter.jsx

27 lines
600 B
JavaScript

import { useContext, useEffect } from 'react';
import GroupChat from '/imports/api/group-chat';
import { GroupChatContext, ACTIONS } from './context';
const Adapter = () => {
const usingGroupChatContext = useContext(GroupChatContext);
const { dispatch } = usingGroupChatContext;
useEffect(() => {
const groupChatCursor = GroupChat.find({});
groupChatCursor.observe({
added: (obj) => {
dispatch({
type: ACTIONS.ADDED,
value: {
groupChat: obj,
},
});
},
});
}, []);
return null;
};
export default Adapter;