I am encountering an issue when trying to fetch data from a REST API. Upon logging the response, I am getting an undefined value. How can I resolve this? I have confirmed that the API is sending data by checking my network tab in the developer tool.
getProductList() : Observable<Product[]>{
return this.httpClient.get<GetResponse>(this.baseUrl).pipe(
map(response => response._embedded.products),
tap((response) => console.log("Response:"+response))
);
}
interface GetResponse{
_embedded:{
products: Product[];
}
}