Skip to content

Instantly share code, notes, and snippets.

@ericdfields
Last active March 2, 2017 21:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ericdfields/75850a95006c592af5697b3fe19005b0 to your computer and use it in GitHub Desktop.
Save ericdfields/75850a95006c592af5697b3fe19005b0 to your computer and use it in GitHub Desktop.
const ajax = require('superagent')
require('superagent-rails-csrf')(ajax)
export default ajax
ajax
.post( parseHref(this.props) )
.setCsrfToken()
.send( updatedPayload(payload,entity) )
.end( (err,response) => {
if (err) {
return standardError()
}
this.setDisabled()
this.props.callback && this.props.callback()
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment