I've read the Rx.js repeat Documentation in an effort to find out how I can continue calling an api based upon the response that I receive from the API. I'm calling an API that can only send back 2k records at a time. The API will send back a value for me to send it so that I can continue receiving the records until they return a done value.
So the flow goes as follows:
- Make a
GETrequest a query parameterreqMode='': - retrieve response with the last array containing
reqModewith avalueordone. - If I receive a
valuethen I need to make the same request but send thereqModeparameter with the value. - If i receive
donethen I'll stop and return all of the records since the first call.
I get the first set of values when subscribing normally, but this would be my attempt after reading the docs, but it doesn't make sense:
getRecords(){
let url = this.url + 'reqMode=';
return this.http.get(url)
.doWhile() //What would I do here
}
When trying to do .doWhile with a Observable that is type Observable<response>. I'm looking for any alternative using Observables for what I need to do.