I m using NGRX to dispatch the id's from the array but i need to make multiple calls at once not looping then on ngOninit
below is the code for dispatch:
loadEmloyeePricing(): void {
let id = [];
this.cartItem.forEach(a => {
id.push(a.service.parameters.item_number)
})
// id -> list of array ids
this.site$.pipe(take(1)).subscribe((site: number | null): void => {
if (site) {
this.store.dispatch(
LOAD_EMPLOYEE_PRICING({
payload: {
pathParams: [site.toString(), id],
},
})
);
}
});
}
ngOnInit(): void {
this.loadEmloyeePricing();
}
Above in the code i need to pass the ids which is in array to dispatch function to make a single call in payload currently passing single id and looping the dispatch function which i dnt want.
i never done this please provide me some idea or solutions how to achieve this?