Prevent empty chat messages

This commit is contained in:
Reckless_Satoshi 2022-03-02 05:12:27 -08:00
parent 6887eed6e3
commit 34a5340e06
No known key found for this signature in database
GPG Key ID: 9C4585B561315571
2 changed files with 9 additions and 7 deletions

View File

@ -48,12 +48,14 @@ export default class Chat extends Component {
} }
onButtonClicked = (e) => { onButtonClicked = (e) => {
this.client.send(JSON.stringify({ if(this.state.value!=''){
type: "message", this.client.send(JSON.stringify({
message: this.state.value, type: "message",
nick: this.props.ur_nick, message: this.state.value,
})); nick: this.props.ur_nick,
this.state.value = '' }));
this.state.value = ''
}
e.preventDefault(); e.preventDefault();
} }

File diff suppressed because one or more lines are too long