I made an http call inside an observable, do you think it is okay or should I split the two?
removeFav(movie:Movie){
this.getFavIdByMovie(movie).subscribe((data)=>{
this.http.delete(`${this.baseURL}/favorites/${data[0].id}`).toPromise();
});
}
another problem here is that i have a function with http request that return me an array of just 1 object and there is no possibility that return me more than 1 obj. How can i change the return into just the obj so in the first i can skip the data[0].id and write just data.id
getFavIdByMovie(movie:Movie){
let userId = this.authSrv.getUserId();
return this.http.get<Favorite>(`${this.baseURL}/favorites?userId=${userId}&movieId=${movie.id}`);
}