test: 单个会话订阅. 发送和接收

dev/chat
Lei OT 2 years ago
parent 785fdffc56
commit 90fd95d977

@ -2,6 +2,6 @@ import { observer } from 'mobx-react';
import { Card } from 'antd'; import { Card } from 'antd';
const CustomerProfile = observer(({ customer }) => { const CustomerProfile = observer(({ customer }) => {
return <Card title={customer.name}>{/* other profile details */}</Card>; return <Card bordered={false} title={customer.name}>{/* other profile details */}</Card>;
}); });
export default CustomerProfile; export default CustomerProfile;

@ -10,14 +10,14 @@ const InputBox = observer(({ onSend }) => {
onSend(v); onSend(v);
setMessage(''); setMessage('');
} }
} };
const sendMessage = async () => { const sendMessage = async () => {
if (message.trim() !== '') { if (message.trim() !== '') {
// const api = new RealTimeAPI('wss://your_rocket_chat_server_url/websocket'); // const api = new RealTimeAPI('wss://your_rocket_chat_server_url/websocket');
// await api.login('your_username', 'your_password'); // replace with your actual username and password // await api.login('your_username', 'your_password'); // replace with your actual username and password
// await api.sendMessage({ roomId: 'ROOM_ID', msg: message }); // replace 'ROOM_ID' with your actual room id // await api.sendMessage({ roomId: 'ROOM_ID', msg: message }); // replace 'ROOM_ID' with your actual room id
setMessage(''); setMessage('');
} }
}; };
return ( return (
@ -26,7 +26,7 @@ const InputBox = observer(({ onSend }) => {
<Button type="primary" className="chat-button"> <Button type="primary" className="chat-button">
Send Send
</Button> */} </Button> */}
<Input.Search placeholder='Type message here' enterButton='Send' size='large' onSearch={handleSend} defaultValue={message} /> <Input.Search placeholder='Type message here' enterButton='Send' size='large' onSearch={handleSend} value={message} onChange={(e) => setMessage(e.target.value)} />
</div> </div>
); );
}); });

Loading…
Cancel
Save