I am working on a function that fetches data from an API. In this process, I execute a total of 3 queries, each returning an array of data. My goal is to combine these 3 arrays into a single iterable array, where the indexes correspond to the original arrays (0 for first array, 1 for second, and so on). Could you please suggest a way to achieve this?
//I attempted to implement this approach, but it resulted in an error.
this.serviceAffaire.getAffairesByServiceAndOperateur(this.servEnCours, this.opeEnCours).pipe(
affaires =>
forkJoin(
this.serviceAffaire.getAffairesByServiceAndOperateurAleas(this.servEnCours, this.opeEnCours),
this.serviceAffaire.getAffairesByServiceAndOperateurUrgent(this.servEnCours, this.opeEnCours),
).pipe(
map(([affairesAleas, affairesUrgent]) => [affairesAleas, affairesUrgent])
)
).subscribe((data : [Affaire, Affaire, Affaire][]) => {
for(let d of data){
for(let n of d[0])
//Encountered an error in the for loop condition, indicating that Type Affaire must have a Symbol.iterator method that returns an iterator.
}
})