I am working in one angular project that have call API in a sequence and API response is stored in single global variable.
My API flow is look like below :
Explaination :
- User click on first request button, then first request is send to server.
- Before display data of first request in html, user click on another button and make second API request.
- here response of first request not returned by server yet and make another request.
- after that, response of second request is occur first.
- then result of first request is occur.
- At that time, all result will merge. but expected output is like this :
- cancel first request and only display result of second request.
Is there any way to cancel all pending request first then make another request. Please help me.