Для того, что вам нужно, вы можете использовать combineLatest
для ожидания всех вторых запросов и добавления к ним результата первого запроса:
getDetails(userName: string) {
this.rep$ = this.http.get<IRep[]>(`${this.api}/users/${userName}/coll1`);
return this.rep$.pipe(switchMap(repos => {
const inactiveRepos = repos.filter((repo) => !repo.active);
combineLatest(
inactiveRepos.map((repo) => this.http.get<IColl2[]>(`${this.api}/repos/${userName}/${repo.name}/coll2`))
).pipe(
map((responses) => responses.map((response) => ({response1: repos, response2: response})))
)
}
}
В приведенном выше примере результатом будет массив, который для каждого элемента будет иметь первый ответ в свойстве response1 и второй ответ в свойстве response2.
UPDATE
Я забыл добавить оператор return в combLatest :
getDetails(userName: string) {
this.rep$ = this.http.get<IRep[]>(`${this.api}/users/${userName}/coll1`);
return this.rep$.pipe(switchMap(repos => {
const inactiveRepos = repos.filter((repo) => !repo.active);
return combineLatest(
inactiveRepos.map((repo) => this.http.get<IColl2[]>(`${this.api}/repos/${userName}/${repo.name}/coll2`))
).pipe(
map((responses) => responses.map((response) => ({response1: repos, response2: response})))
)
}
}