Skip to content

Instantly share code, notes, and snippets.

@matthewtrask
Last active October 19, 2017 19:20
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 matthewtrask/73c9a175c04b21a55af4c0eda53a302f to your computer and use it in GitHub Desktop.
Save matthewtrask/73c9a175c04b21a55af4c0eda53a302f to your computer and use it in GitHub Desktop.
function postJobs(){
// we use axios to make the HTTP request
axios.post('/api/jobs')
// if request is successful, this is what needs to happen
.then(response => {
// do success stuff
}.catch((error => {
// we also get to handle errors, so this promise is where we catch the error and handle it gracefully.
console.error(error);
}
}
function postJobs(){
axios.post('/api/jobs')
.then(response => {
// do success stuff
}.catch((error => {
console.error(error);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment