Added await for deletion to prevent race condition

This commit is contained in:
Jori Lallo 2017-08-03 16:50:17 +03:00
parent ad44c67a46
commit c9e182376e
1 changed files with 2 additions and 2 deletions

View File

@ -28,7 +28,7 @@ type Props = {
this.props.history.push(`${this.props.document.url}/new`);
};
onDelete = () => {
onDelete = async () => {
let msg;
if (get(this.props, 'document.collection.type') === 'atlas') {
msg =
@ -38,7 +38,7 @@ type Props = {
}
if (confirm(msg)) {
this.props.document.delete();
await this.props.document.delete();
this.props.history.push(this.props.document.collection.url);
}
};