You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First of all, thank you for the amazing work. The OpenAPI generator saves days of work and prevents stupid mistakes!
Is your feature request related to a problem? Please describe.
I believe it's common to need request cancellation in a modern app that is of considerable size. Especially useful in SPAs where one probably wants to cancel all on-going requests when navigating to a new page or when doing repetitive actions that should only yield the latest API result.
Describe the solution you'd like
I am imagining something similar to aws-sdk-js which returns request objects with a promise and abort/cancel function.
constrequest=petsApiClient.listPets();request.promise()// promise() returns AxiosPromise.then((result)=>{// handle result}).catch((error)=>{// handle cancels or errors});
...
request.cancel();// makes AxiosPromise reject with Cancel error
This can be achieved with axios.CancelToken inside the {{classname}}Fp function. It would be a breaking change, so should probably need to be configurable?
Describe alternatives you've considered
It's already now possible to cancel requests utilizing the axios.CancelToken.
My goal with this feature request is to make the use of generated API clients/SDKs as simple as possible for the end-users. The typescript-axios template is already awesome, and I hope this can bring it to the next level.
And yes, I do know that there's also the option of using the rxjs template with cancellable observables. However, neither I nor my colleagues have any professional knowledge of observables. Making that switch would be a significant investment, which business will never agree to... :)
First of all, thank you for the amazing work. The OpenAPI generator saves days of work and prevents stupid mistakes!
Is your feature request related to a problem? Please describe.
I believe it's common to need request cancellation in a modern app that is of considerable size. Especially useful in SPAs where one probably wants to cancel all on-going requests when navigating to a new page or when doing repetitive actions that should only yield the latest API result.
Describe the solution you'd like
I am imagining something similar to aws-sdk-js which returns request objects with a promise and abort/cancel function.
This can be achieved with
axios.CancelToken
inside the{{classname}}Fp
function. It would be a breaking change, so should probably need to be configurable?Describe alternatives you've considered
It's already now possible to cancel requests utilizing the
axios.CancelToken
.However, this approach becomes quite funny if you have an operation with many optional arguments.
My goal with this feature request is to make the use of generated API clients/SDKs as simple as possible for the end-users. The
typescript-axios
template is already awesome, and I hope this can bring it to the next level.Additional context
The text was updated successfully, but these errors were encountered: