'how to grab the payload inside of withlatestfrom with ngrx?

hi i have the following code where the selector requires an index to grab a value from the store, I use withLatestFrom to grab this value from the store only the selector requires a value from the payload which is only available inside of switchmap with ac but is there some other rxjs method we can use to grab this value from the action so that we can use it inside of withLatestFrom

  fetchYour = createEffect(() => {
    return this.actions.pipe(
      ofType(rdxMainWalletProtectYourBurnFetch),
      withLatestFrom(this.store.select(getTokenToken), this.store.select(getMainWalletProtectYourProbationem(ac??.index))),
      switchMap(ac => aschax.post('/api/transfer/burn', ac[0].payload!).then(res => {
        return {
          type: RDX_MAIN_WALLET_PROTECT_YOUR_BURN_FETCH_SUCCESS,
          payload: res.data,
          component: ac[0].component
        }
      }).catch((err: AxiosError) => {
        return {
          type: RDX_MAIN_WALLET_PROTECT_YOUR_BURN_FETCH_ERROR,
          payload: err.response?.data,
          component: ac[0].component
        }
      }))
    )
  })

at the place of the question marks i need to grab the index from the action his payload
down below you can find the selector

export const getMainWalletProtectOtherProbationem = (ischin: number) => createSelector(
  getMainWalletProtectFeatureState,
  state => state.otherBids.getIn([ischin, 'probationem'])
)


Solution 1:[1]

You could use concatLatestFrom from ngrx instead of withLatestFrom.

https://ngrx.io/api/effects/concatLatestFrom

https://github.com/timdeschryver/eslint-plugin-ngrx/blob/main/docs/rules/prefer-concat-latest-from.md

this.actions$.pipe(
 concatLatestFrom(() => this.store.select(fromCustomers.selectActiveCustomer))
)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 timdeschryver