Skip to content

Commit

Permalink
fix upload remove
Browse files Browse the repository at this point in the history
  • Loading branch information
hms181231 authored and afc163 committed Jan 16, 2019
1 parent f30c111 commit 4ac517d
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions components/upload/Upload.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ class Upload extends React.Component<UploadProps, UploadState> {
}

recentUploadStatus: boolean | PromiseLike<any>;

progressTimer: any;

private upload: any;
Expand Down Expand Up @@ -161,10 +162,14 @@ class Upload extends React.Component<UploadProps, UploadState> {

handleRemove(file: UploadFile) {
const { onRemove } = this.props;
const { status } = file;

file.status = 'removed'; // eslint-disable-line

Promise.resolve(typeof onRemove === 'function' ? onRemove(file) : onRemove).then(ret => {
// Prevent removing file
if (ret === false) {
file.status = status;
return;
}

Expand All @@ -180,7 +185,7 @@ class Upload extends React.Component<UploadProps, UploadState> {

handleManualRemove = (file: UploadFile) => {
this.upload.abort(file);
file.status = 'removed'; // eslint-disable-line

this.handleRemove(file);
};

Expand Down Expand Up @@ -215,7 +220,8 @@ class Upload extends React.Component<UploadProps, UploadState> {
),
});
return false;
} else if (result && (result as PromiseLike<any>).then) {
}
if (result && (result as PromiseLike<any>).then) {
return result;
}
return true;
Expand Down

0 comments on commit 4ac517d

Please sign in to comment.