Looking at the TypeScript functions below, which are used for async HTTP-Calls:
public retrieveAllMembersIdsFromGroup(groupId: string): Observable<string[]>
public retrieveMember(memberId: string): Observable<Member>
How can these be combined into a single function to obtain all members (Observable)?
public combineAllMembersFromGroup(groupId: string): Observable<Member[]>
For instance, we aim to achieve something similar to this:
public combineAllMembersFromGroup(groupId: string): Observable<Member[]> {
return this.retrieveAllMembersIdsFromGroup(groupId).pipe(
map((membersIds: string[]) => {
//perform necessary actions here to call this.retrieveMember(memberId)
return //Observable<Member[]>;
})
);
}
If possible, it is preferred not to subscribe to the retrieveAllMembersIdsFromGroup method in order to avoid manual processing of the ids. What would be the optimal solution?