Abort server function
I want to allow users to upload image in preview stage, then I have a button where they can decide if they want to upload the image to server then s3,
But when user decides to upload the image to server and clicks a "upload" button, "Cancel" button appears. What I want to achieve is when user clicks "Cancel" button I want to abort the server function execution.
2 Replies
Nothing solid specific here.
You can just use the AbortController api in your event handler
https://developer.mozilla.org/en-US/docs/Web/API/AbortController
MDN Web Docs
AbortController - Web APIs | MDN
The AbortController interface represents a controller object that allows you to abort one or more Web requests as and when desired.
Thanks a lot I will try it soon.