Update file upload API endpoint and add authorization header for secure uploads

This commit is contained in:
Atharva Ombase
2025-08-03 19:26:53 +05:30
parent 5283a2b9f1
commit 7597f52b47
+5 -1
View File
@@ -43,10 +43,14 @@ const FileUploadModal = ({ show, onClose, onUploadSuccess }) => {
try {
setUploading(true);
setUploadMessage("⏳ Uploading file...");
const response = await fetch(`${API_URL}/api/hdfs/uploadFile`, {
const response = await fetch(`${API_URL}/api/files/upload`, {
method: "POST",
headers: {
Authorization: `Bearer ${localStorage.getItem("token")}`,
},
body: formData,
});
if (!response.ok) {
const errorText = await response.text();
setUploadMessage(`❌ Upload failed: ${errorText}`);