Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

axios post request 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);
  });
}
Comment

PREVIOUS NEXT
Code Example
Javascript :: How to get previous url in nextjs 
Javascript :: use jquery in project using NPM 
Javascript :: javaScript new Set() Method 
Javascript :: check if value is array 
Javascript :: javascript forEach() method 
Javascript :: js number padding to number of characters 
Javascript :: url to buffer node.js 
Javascript :: mongoose create text index 
Javascript :: captalize first letter javascript 
Javascript :: navigator user media check if camera is availabe 
Javascript :: copia array javascript 
Javascript :: javascript date to html date input 
Javascript :: scroll up btn 
Javascript :: usecontext hook 
Javascript :: express-rate-limit nodejs 
Javascript :: jquery select direct child 
Javascript :: indefOf 
Javascript :: javascript get currency symbol by currencyCode 
Javascript :: how to make a discord bot send a message 
Javascript :: javascript strftime 
Javascript :: count length of a string javascript 
Javascript :: angular create injectable 
Javascript :: format phone number javascript 
Javascript :: how to make javascript function consise 
Javascript :: xml vs json 
Javascript :: javascript function with string parameter 
Javascript :: react classname 
Javascript :: how to use react typed js 
Javascript :: javascript global function 
Javascript :: change base js 
ADD CONTENT
Topic
Content
Source link
Name
4+2 =