Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] #35

Closed
Liu-Ya opened this issue Apr 15, 2021 · 3 comments
Closed

[Feature Request] #35

Liu-Ya opened this issue Apr 15, 2021 · 3 comments

Comments

@Liu-Ya
Copy link

Liu-Ya commented Apr 15, 2021

需求描述 Feature Description

希望 run 返回 Promise,现在无论执行成功与否都会走到 then

比如批量删除和删除使用同一个请求,但返回后触发不同操作,不适用 onSuccess

建议的解决方案 Proposed Solution

run({}).then(res => {
  // do something
}).catch(err => {})

其他信息 Other information

@John60676
Copy link
Member

onSuccessonError本质上对应的就是 runthencatch。你直接在 onSuccess 里面处理业务就好了。run.then 不建议直接使用,有些特殊情况thenres的值会是null,参考:https://www.attojs.org/zh/api/#run

@Liu-Ya
Copy link
Author

Liu-Ya commented Apr 16, 2021

onSuccessonError本质上对应的就是 runthencatch。你直接在 onSuccess 里面处理业务就好了。run.then 不建议直接使用,有些特殊情况thenres的值会是null,参考:https://www.attojs.org/zh/api/#run

使用 axios resolve() 的时候没有触发onSuccess 反而触发了 onError 是设计如此吗?

@John60676
Copy link
Member

新开一个 issue,提供一个重现 demo。

@Liu-Ya Liu-Ya closed this as completed Apr 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants