Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can I call an API after an API called? #53

Closed
Darmody opened this issue Mar 9, 2016 · 2 comments
Closed

How can I call an API after an API called? #53

Darmody opened this issue Mar 9, 2016 · 2 comments
Labels

Comments

@Darmody
Copy link

Darmody commented Mar 9, 2016

I want to call an API with params which get from the response of another API call.How can I do it?

@rudin
Copy link

rudin commented Mar 9, 2016

It's being described right here:
#21

export function doStuff() {
    return dispatch => {
        dispatch({
            [CALL_API]: {
                ...
                types: [
                    Constants.SOMETHING_FETCHED,
                    {
                        type: Constants.SOMETHING_FETCHED_SUCCEEDED,
                        payload: (action, state, res) => {
                            return res.json().then(json => {
                                dispatch(myAction());
                                return json;
                            });
                        },
                    },
                    Constants.SOMETHING_FETCHED_FAILED,
                ],
                ...

note: redux-thunk needed

@Darmody
Copy link
Author

Darmody commented Mar 9, 2016

I see. Thanks a lot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants