I need to send a picture using axios, then output its url to the console. The backend works fine, it gives an array and the picture is loaded into the folder. But for some reason I cannot output to the front through then to the console. Doesn't output anything at all, although the backend returns that the picture was successfully loaded
const uploadImage = file => {
return new Promise((resolve, reject) => {
let formData = new FormData()
formData.append('imagesUp', file)
const config = {
headers: {
'Content-Type': 'multipart/form-data',
Folder: 'editor',
},
}
axios.post('/api/upload', formData, config).then(responseImage => {
console.log(responseImage)
resolve({ data: { link: '//werafgrswe' } })
})
})
}
{
"status": "success",
"message": "File uploaded successfully",
"data": [
{
"_id": 0,
"name": "2020result-global-town-1609439624185.jpg",
"path": "/uploads/editor/2020result-global-town-1609439624185.jpg",
"size": "1.13 MB"
}
]
}```