Skip to content

Commit

Permalink
fix(file): success with result
Browse files Browse the repository at this point in the history
  • Loading branch information
sylingd committed May 25, 2020
1 parent 0821716 commit e1a8efd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion packages/file/src/types.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export interface Callback {
(): void;
(result?: any): void;
}

export interface CallbackOptions {
Expand Down
9 changes: 5 additions & 4 deletions packages/file/src/web/upload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,14 @@ function uploadFile(param: UploadOption): Promise<UploadFileResult> {
// ignore
}
// success
param.success && param.success();
param.complete && param.complete();
resolve({
const result = {
data,
status: xhr.status,
headers: headerMap,
});
};
param.success && param.success(result);
param.complete && param.complete();
resolve(result);
};
// check if need add withCredentials
if (!param.url.includes(window.location.host)) {
Expand Down

0 comments on commit e1a8efd

Please sign in to comment.