how to track file upload progress in axios code example

Example 1: fileupload progress bar in axios

const config = {
    onUploadProgress: progressEvent => console.log(progressEvent.loaded)
}

Example 2: when is onUploadProgressCalled axios

let response = await axios({
  method: 'post',
  url: imageUploadUrl,
  data: {
    connectorId,
    data
  },
  onUploadProgress: (progressEvent) => {
    const { loaded, total } = progressEvent;
    dispatch(updateImageUploadProgress(loaded, total));
  },
  cancelToken: new CancelToken(token => {
    cancelAxiosRequest = token;
  })
});