diff options
author | 2018-06-30 23:31:03 +0300 | |
---|---|---|
committer | 2023-01-13 10:37:53 +0300 | |
commit | 61523ca4d0eb3a718e9b029bd3e121f3b539b3b1 (patch) | |
tree | edeb7b90c62ae4d36233fb8e6cc7f1400f0efd1d /vnext/src/components | |
parent | fd7dd62c2f08ec993ac2c30f537a53d8e37cff24 (diff) |
WebSockets
Diffstat (limited to 'vnext/src/components')
-rw-r--r-- | vnext/src/components/Chat.js | 8 | ||||
-rw-r--r-- | vnext/src/components/Thread.js | 7 |
2 files changed, 15 insertions, 0 deletions
diff --git a/vnext/src/components/Chat.js b/vnext/src/components/Chat.js index 66e7f804..916de003 100644 --- a/vnext/src/components/Chat.js +++ b/vnext/src/components/Chat.js @@ -33,6 +33,14 @@ export default class Chat extends React.Component { } } + onMessage = (msg) => { + if (msg.user.uname === this.props.match.params.user) { + this.setState({ + chats: [msg, ...this.state.chats] + }); + } + } + onSend = (template) => { pm(template.to.uname, template.body) .then(res => { diff --git a/vnext/src/components/Thread.js b/vnext/src/components/Thread.js index 63359ce0..0ec39d11 100644 --- a/vnext/src/components/Thread.js +++ b/vnext/src/components/Thread.js @@ -56,6 +56,13 @@ export default class Thread extends React.Component { active: msg.rid || 0 }) } + onReply = (msg) => { + if (msg.mid == this.state.msg.mid) { + this.setState({ + replies: [...this.state.replies, msg] + }) + } + } postComment = (template) => { const { mid, rid, body, attach } = template; comment(mid, rid, body, attach).then(res => { |