I am utilizing the element-ui file upload component() to manage the frontend of image uploading. All functionalities work flawlessly (file is successfully sent to the server, etc). However, for some reason, after the axios's successful response code runs, the page automatically refreshes. Interestingly, when I send the same post request without including the file, the page does not auto-refresh.
The submit button type is set to "button," so that is not the issue in this scenario.
Below is the code for the axios post request:
base.post('/add/visit/', formData, {headers: {'Authorization' : 'Bearer ' + localStorage.getItem('token'),'Content-Type': 'multipart/form-data'}})
.then(response => {
console.log(response);
resolve(response);
})
.catch(err => {
console.log(err);
reject(err);
});
})