callback > promise

This commit is contained in:
Tom Moor
2018-01-30 22:49:48 -08:00
parent 85a27593e8
commit 48793a4cef
3 changed files with 41 additions and 44 deletions

View File

@ -54,19 +54,16 @@ class DropToImport extends Component {
}
for (const file of files) {
importFile(
{
documents: this.props.documents,
file,
documentId,
collectionId,
},
doc => {
if (redirect) {
this.props.history.push(doc.url);
}
}
);
const doc = await importFile({
documents: this.props.documents,
file,
documentId,
collectionId,
});
if (redirect) {
this.props.history.push(doc.url);
}
}
} catch (err) {
// TODO: show error alert.