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) => {
this.client.send(JSON.stringify({
type: "message",
message: this.state.value,
nick: this.props.ur_nick,
}));
this.state.value = ''
if(this.state.value!=''){
this.client.send(JSON.stringify({
type: "message",
message: this.state.value,
nick: this.props.ur_nick,
}));
this.state.value = ''
}
e.preventDefault();
}

File diff suppressed because one or more lines are too long