When using forkJoin to make multiple http calls, I encountered the error
error TS2339: Property 'data' does not exist on type 'Object'
forkJoin(this.userservice.getUser(), this.userservice.getDashboard()).pipe(
map(([userData, dashboardData]) => {
// set the user
this.user = userData;
// set order count
this.orderCount.new = dashboardData.data.new.length;
console.log(dashboardData);
this.dataLoaded = true;
})
).subscribe();
I understand that this property comes from an external API which is not set in Angular/Ionic. However, when I try solutions like:
map(([userData, dashboardData<any>]) => {
or similar approaches, it does not work. How can I resolve this?
The getUser and getDashboard methods return HTTP objects:
getUser() {
return this.http.get(environment.baseUrl + '/auth/user').pipe(
map(results => {
console.log(results);
return results;
})
);
}