Is there a way to create a function that can make HTTP calls one after the other, allowing me to use the response from the first call in the second call? For example, retrieving the user's IP address from the first call and then using that IP address to register the user in the second call.
Here's a demonstration of what I am trying to achieve:
registerUser(user: User) {
this.utility.getIpAddress()
.subscribe(data => {
this.ipAddress = data.ip;
});
const body = {
UserName: user.UserName,
Email: user.Email,
//...
UserIP: this.ipAddress,
}
return this.http.post(this.registerAPI, body);
}