I have several requests that must be called one by one:
this.firstRequest()
.flatMap(resp => {
//check response
if(!response.success) {
return Observable.throw('some message');
}
return this.secondRequest();
})
.subscribe(...)
firstRequest() {
// build params and call http service
return this.service.getData(...)
.do(r => {
if(r.success) {
this.localStorage.save('code', r.code)
}
})
.delay(5000);
}
As you can see there is delay between first and second request. But, I need delay only when success field is true. How can I do it?