Does axios not support Synchronize request? Is there any alternative?

now there is a requirement to send API requests in batches, and the number is a bit large. When the web page opens, it will prompt an error soon, because too many requests sent at the same time will be timed out if some of the requests are not sent and executed at the same time.

The axios, used by

does not seem to have the method requested by Synchronize. The following code, is there any way to make GetCombo () Synchronize request?

SetComboList(fromData, toData)
{
  fromData.forEach(element => {
      GetCombo(element.comboID).then(response => {
        let result = response.data;      
        toData.push(result);       
      });
    });
},
Jun.09,2021

restricting concurrency is the correct solution


vue.js tutorials have an example that you can refer to. Listeners section. They used lodash to limit frequent requests.
ide/computed.html" rel=" nofollow noreferrer "https://cn.vuejs.org/v2/guide.


try async/await


what about batch requests?
axios.all try
you want Synchronize. Then chain call on request
see axios official website

clipboard.png


timed out before it could be executed. This is a proposition.

first of all, is the timeout defined by you? If you define it yourself, is the timeout too short .

if you say one minute , that's good. Congratulations, you have too many requests to kill the server. Dude, your server opened for you alone. Whether others need it or not.

Menu