vue-request icon indicating copy to clipboard operation
vue-request copied to clipboard

[Bug Report]接口报错,但run仍走了resolve

Open like0413 opened this issue 3 years ago • 2 comments

Bug 描述 Bug description

customerEdit是一个promise接口,我如下使用:

const { loading, run: customerEditRun } = useRequest(customerEdit)

customerEditRun(params).then(() => {
 // 无论接口正确还是错误全都走到了这里
})

无论接口正确还是错误全都走到了注释位置,但我直接使用customerEdit是没问题的

代码重现 Reproduce

期望结果 Desired result

其他信息 Other information

like0413 avatar Aug 12 '22 07:08 like0413

这是什么版本?v2 的 run 不是 promise 来的

John60676 avatar Aug 12 '22 10:08 John60676

版本:2.0.0-rc.3 仍然返回promise

like0413 avatar Aug 12 '22 10:08 like0413

下版本修复,你用 run 别加 then 就行了

John60676 avatar Aug 15 '22 02:08 John60676