Skip to content

Instantly share code, notes, and snippets.

@fazlurr
Created January 30, 2019 02:47
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 fazlurr/e033aca2fa44cfc216b659fd0fcb7a7a to your computer and use it in GitHub Desktop.
Save fazlurr/e033aca2fa44cfc216b659fd0fcb7a7a to your computer and use it in GitHub Desktop.
let config = {
onUploadProgress: progressEvent => {
let percentCompleted = Math.floor((progressEvent.loaded * 100) / progressEvent.total);
// do whatever you like with the percentage complete
// maybe dispatch an action that will update a progress bar or something
}
}
axios.post('/path/to/post/', data, config)
.then(response => console.log(response));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment