First Http call to fetch Shipment Data IF shipment data is NOT AVAILABLE exceution will be stop with showing error
IF shipment data is AVAILABLE i need to call second and third calls paralalley
I used fork join to call paralell request and after fetching fork join data how to use shipment data inside in the fork join map method.
from(getShipment(this.data.CardId))
.pipe(
filter(shipmentData => shipmentData != undefined),
tap(shipmentData => {
if (shipmentData.ShipmentId === null || shipmentData.ShipmentId === "") {
throw "Shipment needs to be connected"
}
}),
//I NEED TO PASS THIS SHIPMENT DATA TO FORK JOIN PIPE METHOD
map(shipmentData => shipmentData),
concatMap(shipmentData =>
forkJoin([
getOrderLineAllocationByCardIdObservable(this.data.CardId),
getLotsByCardIdObservable(this.data.CardId)
])
.pipe(
filter(response => response != undefined),
map(([inventoryData, lotsData],shipmentData) => {
//I NEED TO ACCESS SHIPMENT DATA IN HERE
//SHIPMENT DATA NOT AVAILABLE IN HERE
})
)
),
// Catch errors thrown above
catchError(error => {
return EMPTY;
}),
// Always finish by Hiding Loading indicator
finalize(() => this.store.dispatch(setLoadingSpinner({showLoading: false})))
)
.subscribe();
Just remove
shipmentData
as argument from your map function, its already there:runnable example: https://stackblitz.com/edit/rxjs-t5mzxy?file=index.ts