Home > Software design >  Is it possible to not stop an api call which is doing some operation in server side if i redirect to
Is it possible to not stop an api call which is doing some operation in server side if i redirect to

Time:08-06

I used post method to send some data through an API calling to Nodejs and waiting for the response after getting the response it will trigger another API. At this moment user wants to visit another page but API call will not be aborted. Api call will do its task. Is it possible to do so?

CodePudding user response:

Call the API in redux using redux-thunk. Since redux is outside of all component. Changing page won't stop the API calling

CodePudding user response:

You can just create a state variable and save the response of the post request in that variable, so it will be saved

  • Related