I wrote a function called getAll
getAll<T>() {
return this.http.get(`${environment.apiUrl}/products`);
}
Here is how I am invoking it:
this.productService.getAll()
.pipe(first())
.subscribe(products => {
debugger
let s = products;
this.products = products.response;
});
However, I encountered an error:
Property 'response' does not exist on type 'Object'.ts(2339)
The server response can be in the following formats:
{"status":200,"error":null,"response":[]}
{"status":200,"error":null,"response":{}}
{"status":200,"error":null,"response":"any string"}