Answer the question
In order to leave comments, you need to log in
How to execute sequential requests in JS (VueJS)?
There is an array of objects, the number of objects varies depending on the selected parameters, most likely it can be 16 objects, of which 1 to 16 can be selected
Example of an array:
let arrayObjects = [
{
id: 1,
name: 'test1',
selected: true,
},
{
id: 2,
name: 'test2',
selected: false,
},
{
id: 3,
name: 'test3',
selected: true,
},
]
Answer the question
In order to leave comments, you need to log in
const quiz = async (arrayObjects) => {
for (const object of arrayObjects) {
if (object.selected) {
const result = await fetch(...);
}
}
}
You can use async/await or promises for requests.
https://learn.javascript.ru/async-await
https://learn.javascript.ru/promise
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question