pikax/vue-composable

Idea: Cancel the promise when beforeDestroy is triggered

wizardnet972 opened this issue · 1 comments

Idea: Cancel the promise when beforeDestroy is triggered.

The most cases (for me) when I use usePromise, I was need to cancel the promise/axios when the request took a long time and in meanwhile I navigate to another page.

I think it will be nice if vue-composable will support cancellation on beforeDestory event by demand.

Something like;

usePromise(.., { beforeDestory: true });
pikax commented

That's possible with useAxios and useFetch, but as far as I know, you can't actually stop a promise in javascript.

But for axios and fetch that's a great idea 👍