Open rotate-life opened 4 days ago
微信小程序
小程序基础库: 3.2.4 使用框架: React
function interceptor(chain: Taro.Chain) { const { requestParams } = chain let p: Promise<void> const res = new Promise<void>((resolve, reject) => { const timeout: ReturnType<typeof setTimeout> = setTimeout(() => { p = chain.proceed(requestParams) p .then((r: any) => { resolve(r) }) .catch((err) => { reject(err) }) }, 3000) }) // @ts-ignore if (!isUndefined(p) && isFunction(p.abort)) res.abort = p.abort return res } const requestTask = Taro.request() requestTask.abort()
正常返回abort并且可以正常使用
TypeError: requestTask.abort is not a function
👽 Taro v3.6.17 Taro CLI 3.6.17 environment info: System: OS: macOS 13.4.1 Shell: 5.9 - /bin/zsh Binaries: Node: 16.20.1 - /usr/local/bin/node Yarn: 1.22.19 - /usr/local/bin/yarn npm: 8.19.4 - /usr/local/bin/npm npmPackages: @tarojs/cli: 3.6.17 => 3.6.17 @tarojs/components: 3.6.17 => 3.6.17 @tarojs/helper: 3.6.17 => 3.6.17 @tarojs/plugin-framework-react: 3.6.17 => 3.6.17 @tarojs/plugin-platform-alipay: 3.6.17 => 3.6.17 @tarojs/plugin-platform-h5: 3.6.17 => 3.6.17 @tarojs/plugin-platform-jd: 3.6.17 => 3.6.17 @tarojs/plugin-platform-qq: 3.6.17 => 3.6.17 @tarojs/plugin-platform-swan: 3.6.17 => 3.6.17 @tarojs/plugin-platform-tt: 3.6.17 => 3.6.17 @tarojs/plugin-platform-weapp: 3.6.17 => 3.6.17 @tarojs/react: 3.6.17 => 3.6.17 @tarojs/runtime: 3.6.17 => 3.6.17 @tarojs/shared: 3.6.17 => 3.6.17 @tarojs/taro: 3.6.17 => 3.6.17 @tarojs/taro-loader: 3.6.17 => 3.6.17 @tarojs/webpack5-runner: 3.6.17 => 3.6.17 babel-preset-taro: 3.6.17 => 3.6.17 eslint-config-taro: 3.6.17 => 3.6.17 react: ^18.0.0 => 18.2.0
场景:每次发起请求前,检验token,在过期时,尝试更新一次token
相关平台
微信小程序
小程序基础库: 3.2.4 使用框架: React
复现步骤
期望结果
正常返回abort并且可以正常使用
实际结果
TypeError: requestTask.abort is not a function
环境信息
补充信息
场景:每次发起请求前,检验token,在过期时,尝试更新一次token