publish: prevent submission of empty notes
The onclick would fire regardless of disabled attr.
This commit adds a conditional check to the onclick's function.
@@ -23,6 +23,8 @@ export class NewPost extends Component {
}
postSubmit() {
+ const { state, props } = this;
+ if (state.submit && !state.disabled) {
let newNote = {
"new-note": {
who: this.props.ship.slice(1),
@@ -46,6 +48,7 @@ export class NewPost extends Component {
}
});
}
+ }
componentWillMount() {
window.api.fetchNotebook(this.props.ship, this.props.book);
