I'm executing some requests in loop for the same API. On server-side I need to check the previous result to make some changes. But I can't see the previous result if requests are more than one in loop.
in component:
this.service.createEmail(...).delay(5000).debounceTime(5000).timeout(5000).subscribe(...);
and in service:
createEmail(...): Observable<Json> {
return this.http
.post('url',
JSON.stringify(model),
{ headers: this.headers })
.delay(5000).debounceTime(5000).timeout(5000)
.map((response: Response) => {
return this.responseService.extractData(response);
})
.catch(error => {
return this.errorService.handleError(error);
});
}
didn't help me. Needed imports exist. Just js setInterval helped me.
How can I do delay before http request in other ways?
setTimeout(() => { .. }, 5000)? Maybe that might help