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/Chat.js | |
parent | fd7dd62c2f08ec993ac2c30f537a53d8e37cff24 (diff) |
WebSockets
Diffstat (limited to 'vnext/src/components/Chat.js')
-rw-r--r-- | vnext/src/components/Chat.js | 8 |
1 files changed, 8 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 => { |