fix: 修复部分环境无 clearTimeout 的问题

This commit is contained in:
xream
2023-09-18 20:09:03 +08:00
parent 9acc161684
commit 7603fac036
2 changed files with 4 additions and 2 deletions
+3 -1
View File
@@ -316,7 +316,9 @@ export function HTTP(defaultOptions = { baseURL: '' }) {
return (
timer
? Promise.race([timer, worker]).then((res) => {
clearTimeout(timeoutid);
if (typeof clearTimeout !== 'undefined') {
clearTimeout(timeoutid);
}
return res;
})
: worker