Skip to content

Commit

Permalink
refine code
Browse files Browse the repository at this point in the history
  • Loading branch information
nanxiaobei committed Nov 28, 2023
1 parent 953c9cf commit 6a9b385
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/ImgCrop.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ const ImgCrop = forwardRef<CropperRef, ImgCropProps>((props, cropperRef) => {
// https://ant.design/components/upload-cn#api
// https://github.com/ant-design/ant-design/blob/master/components/upload/Upload.tsx#L152-L178
const result = await beforeUpload(file, [file]);
pass(result !== true ? result : rawFile);
pass((result !== true && result) || rawFile);
} catch (err) {
fail(err as BeforeUploadReturnType);
}
Expand All @@ -226,7 +226,7 @@ const ImgCrop = forwardRef<CropperRef, ImgCropProps>((props, cropperRef) => {
return runRawBeforeUpload(beforeUpload, file, resolve, reject);
}
if (result !== true) {
processFile = result as unknown as RcFile;
processFile = (result as unknown as RcFile) || file;
}
} catch (err) {
return runRawBeforeUpload(beforeUpload, file, resolve, reject);
Expand Down

0 comments on commit 6a9b385

Please sign in to comment.