Skip to content

Instantly share code, notes, and snippets.

@simistern
Last active December 7, 2016 01:31
Show Gist options
  • Save simistern/2ac1d50ef3e6327aea46df09fbc74203 to your computer and use it in GitHub Desktop.
Save simistern/2ac1d50ef3e6327aea46df09fbc74203 to your computer and use it in GitHub Desktop.
export function postSubmissionEdit(body, cb) {
return function(dispatch) {
dispatch(postSubmissionEditRequest())
superagent
.post(config.BASE + '/api/editsubmission')
.send(body)
.withCredentials()
.end((err, res) => {
if (err) {
alert(err.response.body.message)
dispatch(postSubmissionEditFailure(err))
} else {
console.log("we have a response!");
console.log(res);
dispatch(postSubmissionEditSuccess(res.body))
if (cb) {
cb(res.body)
}
}
})
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment