I'm using a little bit complicated API, and I could use some of your help.
There it is. I'm getting important data in packages. Each package contains 10 of them, but I need to create a list of all
eg.
I'm getting data from one of them : ['1', '2', '3', '4', '5','1', '2', '3', '4', '5'] and then I get next package : ['4', '5','1', '2', '3', '1', '2', '3', '4', '8'] and next one and next one till my condition stands.
So I do it using a do-while loop. It looks like that :
do {
this.getMyDataPart(i).then( result => {
list = list.concat(result);
i++;
});
} while(cool);
getMyData(idofPackege: number): Observable<DataObject> {
return this.http.get<DataObject>(this.apiURL + idofPackege);
}
The problem is that I don't know how many times this loop will be made, so I need the actions to be done one by one. And after almost after 2 hours of trying I don't know how to do it well.
I have to wait until that result comes before I decide to increment I and get another pack of data.