Fixed Upload and Download

This commit is contained in:
Devoalda 2023-10-30 14:03:00 +08:00
parent bb9a1e7f82
commit b6b91fcc1a
2 changed files with 3 additions and 3 deletions

View File

@ -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

View File

@ -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);