Skip to content

Instantly share code, notes, and snippets.

@Ledoux
Created April 8, 2019 22:45
Show Gist options
  • Save Ledoux/7cb6abe92d511795ad5eca53b7ea1638 to your computer and use it in GitHub Desktop.
Save Ledoux/7cb6abe92d511795ad5eca53b7ea1638 to your computer and use it in GitHub Desktop.
...
class Offer extends Component {
componentDidMount () {
const { dispatch, match: { params: { offerId } } } = this.props
dispatch(requestData({
apiPath: `/offers/${offerId}`,
normalizer: {
stocks: 'stocks'
}
}))
}
handleAddStock = available => () => {
const { dispatch, match: { params: { offerId } } } = this.props
dispatch(requestData({
apiPath: '/stocks',
body: {
available,
offerId
},
method: 'POST',
}))
}
render () {
const { offer, stocks } = this.props
if (!offer) {
return null
}
...
}
}
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment