mirror of
https://github.com/urbit/shrub.git
synced 2024-12-11 11:02:25 +03:00
publish: catch duplicate note titles
This commit is contained in:
parent
1272a61443
commit
c8fe63dddc
@ -32,12 +32,17 @@ export class NewPost extends Component {
|
||||
}
|
||||
}
|
||||
|
||||
this.setState({
|
||||
awaiting: newNote["new-note"].note
|
||||
}, () => {
|
||||
window.api.setSpinner(true);
|
||||
window.api.action("publish", "publish-action", newNote);
|
||||
});
|
||||
window.api.action("publish", "publish-action", newNote).then(() =>{
|
||||
this.setState({ awaiting: newNote["new-note"].note });
|
||||
}).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});
|
||||
window.api.action("publish", "publish-action", newNote);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
componentWillMount() {
|
||||
|
Loading…
Reference in New Issue
Block a user