Is this a valid way to create a header in react ? as in adding the header constant the way i did. I pointed to the line with a arrow.
const upload = (file, onUploadProgress) => {
let formData = new FormData();
formData.append("file", file);
const header = new Headers(authHeader());
header.set('Accept', 'application/json');
header.set('Content-Type', 'application/json');
header.set("Content-Type", "multipart/form-data")
return axios.post(API_URL + "upload", formData, {
headers: header, <---- this part.
onUploadProgress,
});
};