Unfortunately, the website's structure requires me to retrieve data from various URLs where the same type of data in JSON format is located. These URLs are used for classification purposes, so I must retain them to categorize the data in the app. The service function below attempts to fetch data based on a set of topics, but it currently does not return anything:
getDataTopicItems(topicArray) {
return this.items = topicArray.forEach((topic, i, topicArray) => {
return this.http.get(this.baseUrl + topic + "/_api/Web/Lists/GetByTitle('What''s New')/items", this.options)
.map(res => res.json())
.map(items => items.d.results)
.do(data => console.log(data))
.concatMap(data => data)
}
)
}
I am subscribing to the function in the component template using *ngFor and an async pipe. What could be the issue in my implementation?
Update: I also attempted the following:
return this.http.get(this.baseUrl + topicArray[0] + this.policyOptions, this.options)
.map(res => res.json())
.map(items => this.policies = items.d.results)
.do(data => console.log(data))
.flatMap((policies) => topicArray.forEach((topic, i, topicArray) => {
if (i < 0) {
this.http.get(this.baseUrl + topic + this.policyOptions)
.map(res => res.json())
.map(items => this.policies = items.d.results)
.do(data => console.log(data))
}
}))