From b6b91fcc1a6ff1e82ca7587e5c019f010f60ede0 Mon Sep 17 00:00:00 2001 From: Devoalda Date: Mon, 30 Oct 2023 14:03:00 +0800 Subject: [PATCH] Fixed Upload and Download --- safeshare/safeshare-frontend/src/pages/downloadFile.js | 2 +- safeshare/safeshare-frontend/src/pages/shareFile.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/safeshare/safeshare-frontend/src/pages/downloadFile.js b/safeshare/safeshare-frontend/src/pages/downloadFile.js index 6f6731c..3fcbcfe 100644 --- a/safeshare/safeshare-frontend/src/pages/downloadFile.js +++ b/safeshare/safeshare-frontend/src/pages/downloadFile.js @@ -44,7 +44,7 @@ function DownloadFile() { const handleDownloadFile = () => { if (passcode) { - axios.get(`${apiUrl}/api/files/${passcode}/`, {responseType: 'blob'}) + axios.get(`http://${apiUrl}/api/files/${passcode}/`, {responseType: 'blob'}) .then(response => { let filename = 'downloaded_file'; // Default filename let mimeType = 'application/octet-stream'; // Default MIME type diff --git a/safeshare/safeshare-frontend/src/pages/shareFile.js b/safeshare/safeshare-frontend/src/pages/shareFile.js index 7085ffb..e99838b 100644 --- a/safeshare/safeshare-frontend/src/pages/shareFile.js +++ b/safeshare/safeshare-frontend/src/pages/shareFile.js @@ -53,7 +53,7 @@ function ShareFile() { // Send POST request to the backend API using Axios axios - .post(`${apiUrl}/api/files/`, formData) + .post(`http://${apiUrl}/api/files/`, formData) .then((response) => { // Handle a successful response from the server, set passcode to "key" in the response body const data = response.data; @@ -61,7 +61,7 @@ function ShareFile() { // If data is an array, take the first item if (Array.isArray(data)) { const passcode = data[0].key; - const baseUrl = '${apiUrl}/api/files/'; + const baseUrl = 'http://' + apiUrl + '/api/files/'; setPasscode(passcode); setShareableLink(baseUrl + passcode);