Hello, I'm doing an angular process, in the 'ngOnInit ()' method, where I need to perform 3 HTTP methods, which are asynchronous. one depends on the other's response. for example:
1st call: get a token
2nd call: it will only happen after the 1st, and will get the longitude and latitude
3rd call: will receive a list of objects, passing as parameters the token and the coordinates.
However, I do not know how to perform these methods in order, that is, wait for the response from one to start the other ...
First call code:
ngOnInit(): void {
this.apiDeSegurancaService.ObterToken().subscribe(
res => {
this.apiDeSegurancaService.AdicionandoToken(res.access_token);
},
error => {
console.log(error._body);
this.token = this.apiDeSegurancaService.ObtendoToken();
}
);
}
Thank you in advance ....