Whenever a user clicks on a specific button, a request is sent to the server and an answer is received. If the user clicks on this button 100 times, I want to send 100 consecutive requests to the server. Each request must be sent after the previous one, as the response from the previous request is required for the next one.
For example:
<button @click="sendRequest">send</button>
methods:{
sendRequest:function(){
axios.post('https:/url/store-project-item', {
'id': this.project.id,
"items": this.lists,
'labels': this.labels,
'last_update_key': this.lastUpdateKey,
'debug': 'hYjis6kwW',
}).then((r) => {
if (r.data.status) {
this.change = false;
this.lastUpdateKey = r.data.lastUpdateKey;
this.showAlert('success');
} else {
if (r.data.state == "refresh") {
this.showAlert('error');
this.getProject();
} else {
this.showAlert('error');
}
}
}).catch(() => {
this.showAlert('error');
});
}
}