I'm requesting an api for the Angular Ionic project. I transfer the incoming data to two variables that are the same. But when I filter, the main parameter, "response," also changes.
When I wish" response " to remain the same, I want different filters to different parameter. Please help me.
//
venues: Venue
kahvaltiMekani: Venue
//
var searchVenuesSubscribe = this.searchVenueService.searchVenues(String(jsonParse.gitmeSebebi.join(",")).replace(" ", "+"), String(jsonParse.latLng));
searchVenuesSubscribe.pipe(map(imm=>{
this.venues = imm
this.venues.response.venues = this.venues.response.venues.filter((thing, i, arr) => {
return arr.indexOf(arr.find(t => t.name === thing.name)) === i;
});
this.venues.response.venues.forEach(item => {
try {
this.distanceMatrix(jsonParse.lat, jsonParse.lng, item.location.lat, item.location.lng, item);
}
catch{ }
});
this.kahvaltiMekani = imm;
this.kahvaltiMekani.response.venues = this.kahvaltiMekani.response.venues.filter(a => a.categories.find(b => b.id === "4bf58dd8d48988d179941735"
|| b.id === "4bf58dd8d48988d16a941735" || b.id === "52e81612bcbc57f1066b79f1" || b.id === "4bf58dd8d48988d143941735" || b.id === "52e81612bcbc57f1066b7a0c" || b.id === "4bf58dd8d48988d16d941735") !== undefined)
.slice(0, 1);
})).subscribe(response => {
});