Your question is hard to answer without much context. But if I understand you correctly I think what you are looking for is to delay the axios request and wait a few seconds to ensure it hasn't been cancelled before sending the request. This is called a concurrency method. Using setTimeout()
will wait a certain amount of time before running any code inside of it. It is also very good to ensure users do not spam requests to your end point and wait for the newest and most recent request and return that back (if you decide to wrap your whole request in a timeout):
return axios.get('your-end-point').then(response => setTimeout(response, 1000)));
Note: 1000 here is 1000 m/s. You can change this value to be longer or shorter depending on how long you wish to wait for.
See more about setTimeout and concurrency here: https://developer.mozilla.org/en-US/docs/Web/JavaScript/EventLoop