I have two different API endpoints. One returns a Cards object, the other an Array of Cards objects. What I want to do is get the first Card as the first element in the Array from the second endpoint. Is there any way to do that? Both are observables returned from HTTPClient, so maybe it would be simple to do with some operator, but I don't know enough to do that yet. Just to illustrate it better:
I have:
latestCards$: Observable<Cards> = http.get('latestCardsEndpoint');
// { title: 'Latest', cards: [], ... }
featuredCards$: Observable<Cards[]> = http.get('featuredCardsEndpoint');
// [
// { title: 'Featured1', cards: [], ... },
// { title: 'Featured2', cards: [], ... },
// ...
// ]
I need
homeCards$: Observable<Cards[]>;
// [
// { title: 'Latest', cards: [], ... },
// { title: 'Featured1', cards: [], ... },
// { title: 'Featured2', cards: [], ... },
// ...
// ]