Quiero saber cómo guardar el idPlaylist (que me devuelve http.post
) en una variable para después usarlo en el http.put
crearPlaylist(playlist : Playlist){
var UrlLog = "https://censoredherokuapp.com/playlist/save/";
var UrlLog2 = "http://censored.herokuapp.com/cliente/createPlaylist";
var myString = JSON.stringify(playlist);
var idPlaylist;
var response = this.http.post(UrlLog,myString,httpOptions).subscribe(data =>{
console.log(data);
idPlaylist = data["id"];
return idPlaylist;
});
console.log(idPlaylist);
this.http.put(UrlLog2+this.usserLogged.correo+idPlaylist,httpOptions);
return response;
}