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

This commit is contained in:
xream
2023-09-18 20:09:03 +08:00
parent ed1fa5d675
commit a778d2e222
2 changed files with 4 additions and 2 deletions

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