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

Side Effects After Posting Data #47

Closed
hnordt opened this issue Jan 27, 2016 · 1 comment
Closed

Side Effects After Posting Data #47

hnordt opened this issue Jan 27, 2016 · 1 comment

Comments

@hnordt
Copy link
Contributor

hnordt commented Jan 27, 2016

What's the best practice to handle side effects after posting data?

Here is my approach:

export default connect(({ history }) => ({
  saveCondition: condition => ({
    saveConditionResponse: {
      method: 'POST',
      url: '/medical/condition',
      body: JSON.stringify(condition),
      andThen: newCondition => {
        history.push(`/medical/${newCondition.id}`);
        return {};
      }
    }
  })
}))(ConditionFormContainer);
@ryanbrainard
Copy link
Contributor

Yes, I think that is the best way to do it.

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

No branches or pull requests

2 participants