Skip to content

Commit

Permalink
Fixed #51
Browse files Browse the repository at this point in the history
  • Loading branch information
PatrickSachs committed Feb 6, 2019
1 parent db4920b commit 29020dc
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions components/fields/FileField.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,16 @@ export default class FileField extends React.Component {
});
}

onChange(e) {
async onChange(e) {
if (e.currentTarget.files.length === 0) {
return;
}
const { multiple, onChange } = this.props;
const nativeArray = [...e.currentTarget.files]
if (multiple) {
onChange(Promise.all(nativeArray.map(this.uploadFile)))
onChange(await Promise.all(nativeArray.map(this.uploadFile)))
} else if (nativeArray.length) {
onChange(this.uploadFile(nativeArray[0]));
onChange(await this.uploadFile(nativeArray[0]));
} else {
onChange({ name: "", size: 0, type: "", data: "" });
}
Expand Down

0 comments on commit 29020dc

Please sign in to comment.