1

I'm working on redux-thunk project which i need to reach out endpoint-1 to get which & how many components i need to show in a page. Then i'm required to use this return to reach out endpoint-2 and get the data with the parameters from the enpoint-1.

I'm having hard time to create the correct logic. Also i'm sharing a diagram which i hope gives you the idea and requirements.

Flow Diagram

Thanks

export const fetchByPage = () => async dispatch => {
  const response = await streams.get("byPage?", {
    params: parameters.byPageParams
  });
  console.log(response.data);
  dispatch({ type: FETCH_BY_PAGE, payload: response.data });
};


export const fetchPersons = () => async dispatch => {
  const response = await streams.get(URL, {
    params: parameters.byCriteriaParams
  });
  dispatch({ type: FETCH_PERSONS, payload: response.data });
};

Here are my actions. I'm trying to update byCriteriaParams with the data returns from fetchByPage call.

behcet ilhan
  • 21
  • 1
  • 4
  • 4
    You'll need to post the relevant code (please only the relevant part). Read about creating a **[mcve]** and then update the question with relevant information. – Reinstate Monica Cellio Dec 19 '18 at 13:53

0 Answers0