Skip to content

Instantly share code, notes, and snippets.

@Attila03
Created September 25, 2017 14:05
Show Gist options
  • Save Attila03/62e647427f843ca6beba58fe9c54ad1f to your computer and use it in GitHub Desktop.
Save Attila03/62e647427f843ca6beba58fe9c54ad1f to your computer and use it in GitHub Desktop.
actions : {
createTourney (context, payload) {
return new Promise (resolve, reject) {
// prepare data to be sent
axios({
// mthod,url, data....
validateStatus: function (status) {
return (status >= 200 && status < 300) || (status === 400)
}
}).then(response => {
if (response.status === 400) {
resolve(response)
} else {
//store commits
}
}).catch(error => {
console.log(error)
})
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment