Skip to content

Commit

Permalink
fix: remove condition of enableDownload or enableUpload
Browse files Browse the repository at this point in the history
  • Loading branch information
JOU-amjs committed Jan 15, 2024
1 parent a5be324 commit 040f323
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 13 deletions.
4 changes: 2 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
},
"editor.suggestSelection": "recentlyUsedByPrefix", // 自动补全
"editor.codeActionsOnSave": {
"source.organizeImports": true,
"source.fixAll.eslint": true // 修复所有代码
"source.organizeImports": "explicit",
"source.fixAll.eslint": "explicit"
}
}
18 changes: 7 additions & 11 deletions src/requestAdapter.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ProgressUpdater } from 'alova';
import axios, { AxiosResponseHeaders } from 'axios';
import { AdapterCreateOptions, AxiosRequestAdapter } from '../typings';
import { noop, undefinedValue } from './helper';
import { noop } from './helper';

/**
* axios请求适配器
Expand All @@ -22,17 +22,13 @@ export default function requestAdapter(options: AdapterCreateOptions = {}) {
data: method.data,
signal: controller.signal,
// `onUploadProgress` 允许为上传处理进度事件
onUploadProgress: config.enableUpload
? event => {
uploadHandler(event.loaded, event.total || 1);
}
: undefinedValue,
onUploadProgress: event => {
uploadHandler(event.loaded, event.total || 1);
},
// `onDownloadProgress` 允许为下载处理进度事件
onDownloadProgress: config.enableDownload
? event => {
downloadHandler(event.loaded, event.total || 1);
}
: undefinedValue,
onDownloadProgress: event => {
downloadHandler(event.loaded, event.total || 1);
},
...config
});

Expand Down

0 comments on commit 040f323

Please sign in to comment.