D
D
Denioo2020-07-08 13:24:18
JavaScript
Denioo, 2020-07-08 13:24:18

How to transfer config to axios?

Good afternoon, how can I implement the transfer of the config parameter to axios?
There is a method that is used in many places.

async putFiles(url, params, config) {
    let formData = generateFormData(params);
    return execRequest(async () => {
      return await AXIOS.put(url, formData, {...config});
    })
  }


I pass the parameters, and the config which I then deploy in this method.
And in the component, I call this method and pass the following parameters to the config:
{
              headers: {'Content-Type': 'multipart/form-data'},
              onUploadProgress: (itemUpload: any) => {
                this.fileProgress = itemUpload.loaded
                console.log(itemUpload, this.fileProgress)
              }
            }


But for some reason it doesn’t display, but the download status needs to be monitored, maybe I’m passing this third parameter incorrectly?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Eugene, 2020-07-08
@Nc_Soft

AXIOS.put(url, formData, config)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question