Axios Post Progress Progress
//get use the onDownloadProgress, other requests use the onUploadProgress. (Please mention me for any corrections)
import Axios from 'axios';
function makeRequest () {
config={
function onUploadProgress (ev) {
console.log(ev);
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
// do your thing here
}
function onDownloadProgress(ev) {
console.log(ev);
// do your thing here
}
}
axios.post('/to/path', data, yourConfigIfAny)
.then(({ data }) => {
console.log(data);
});
}
Hurt Hamster