erikras / erikras/react-redux-universal-hot-example

multiple promises in action creator

Open
#1,227 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
12.1k
Forks
2.5k
PR merge metrics
No merged PRs in 30d

Description

I have the following action creator:
export function loadData() {
return {
types: [LOAD, LOAD_SUCCESS, LOAD_FAIL],
promise: (client) => client.get(LOAD_DATA_URL)
};
}
What I need to do is make another api call with the data is returned from this action. I tried using a 'then' but then the store doesn't get updated. I also tried to call another action from the component to get the additional data. This is successful as the data shows up in the server console but in the browser, the action fails in a loop.
What is the proper way to do this? Should an action launch another action? Any samples would be greatly appreciated.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.