diff --git a/pkg/interface/publish/src/js/components/lib/new-post.js b/pkg/interface/publish/src/js/components/lib/new-post.js index d71a217539..d9aed35061 100644 --- a/pkg/interface/publish/src/js/components/lib/new-post.js +++ b/pkg/interface/publish/src/js/components/lib/new-post.js @@ -23,28 +23,31 @@ export class NewPost extends Component { } postSubmit() { - let newNote = { - "new-note": { - who: this.props.ship.slice(1), - book: this.props.book, - note: stringToSymbol(this.state.title), - title: this.state.title, - body: this.state.body, + const { state, props } = this; + if (state.submit && !state.disabled) { + let newNote = { + "new-note": { + who: this.props.ship.slice(1), + book: this.props.book, + note: stringToSymbol(this.state.title), + title: this.state.title, + body: this.state.body, + } } - } window.api.setSpinner(true); this.setState({ disabled: true }); - window.api.action("publish", "publish-action", newNote).then(() =>{ + window.api.action("publish", "publish-action", newNote).then(() => { this.setState({ awaiting: newNote["new-note"].note, disabled: false }); }).catch((err) => { if (err.includes("note already exists")) { let timestamp = Math.floor(Date.now() / 1000); newNote["new-note"].note += "-" + timestamp; - this.setState({awaiting: newNote["new-note"].note, disabled: false}); + this.setState({ awaiting: newNote["new-note"].note, disabled: false }); window.api.action("publish", "publish-action", newNote); } }); + } } componentWillMount() {