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

@ -40,19 +40,15 @@ class CollectionMenu extends Component {
this.file.click();
};
onFilePicked = (ev: SyntheticEvent) => {
onFilePicked = async (ev: SyntheticEvent) => {
const files = getDataTransferFiles(ev);
const document = await importFile({
file: files[0],
documents: this.props.documents,
collectionId: this.props.collection.id,
});
importFile(
{
file: files[0],
documents: this.props.documents,
collectionId: this.props.collection.id,
},
document => {
this.props.history.push(document.url);
}
);
this.props.history.push(document.url);
};
onEdit = (ev: SyntheticEvent) => {