code snippet
const progress_value = ref(0);
const file = ref(null)
let fd = new FormData();
if (file.value.length === 1){
fd.append('file', file.value[0])
}
const config_post = {
headers:{
'Content-Type': 'multipart/form-data',
'Access-Control-Allow-Origin': '*'
},
onUploadProgress: (event) => {
progress_value.value = Math.round( 100 * event.loaded / event.total)
},
params: {
fname: 'myfile'
}
responseType: "blob",
timeout: 500000
};
if (props.timeout !== undefined){
config_post["timeout"] = props.timeout
}
if (c_params.value !== undefined){
config_post["params"] = Object.assign({}, ...c_params.value.map(
function(data_loop) {
return {[data_loop.label]: data_loop.value}
}))
}
axios.post(url_post, fd, config_post).then(res_post => {
}).catch((e) => {
console.log(e)
isConverting.value = false
}).finally(() => {
// set_open_cpLoading(false)
})
}