[Solved] typescript method returning undefined?


Rewrite your getCampaignsToClone method so it returns an Observable sequence. Use flatMap to subscribe to the getUnpaginatedCampaigns observable in turn.

getCampaignsToClone(flight: Flight): Observable<CampaignUnpaginated[]> {
 return this.campaignService.getStatuses().pipe(
    map(data => data.filter( x => x.code === (CampaignStatusCode.IN_PROGRESS || CampaignStatusCode.READY)).map(x => x.id)),
    flatMap(ids => this.campaignService.getUnpaginatedCampaigns({
        statuses: ids,
        accounts: flight.campaign.account.id,
    }))
  );
}

2

solved typescript method returning undefined?