I am attempting to perform two HTTP requests consecutively, with the second request depending on the result of the first. However, it seems like I am overlooking something:
getParkingSpots(date) {
var gmt = this.getTimezone().subscribe(data=>{
if(data=="GMT"){
return this.http.get(url1+date+"GMT").map(res=>res);//here is where I retrieve the desired data
}
else{
return this.http.get(url2+date).map(res=>res);//this is the data I need
}
})
}
this.parkpace.getParkingSpots(dd).subscribe(data=> {//this is how I use it
this.ParkingSpaces = data;
console.log(data);
console.log("dd="+dd);
});