Fixed Upload and Download
This commit is contained in:
parent
bb9a1e7f82
commit
b6b91fcc1a
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue