From 94623b7c4bf1b477a5634d20ce3e27c52e3b4ed1 Mon Sep 17 00:00:00 2001 From: Benjamin Loh Date: Mon, 23 Oct 2023 15:38:51 +0800 Subject: [PATCH] added ttl to post req added ttl to post req --- safeshare/safeshare-frontend/src/pages/downloadFile.js | 2 +- safeshare/safeshare-frontend/src/pages/shareFile.js | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/safeshare/safeshare-frontend/src/pages/downloadFile.js b/safeshare/safeshare-frontend/src/pages/downloadFile.js index 6fe66c1..03b333c 100644 --- a/safeshare/safeshare-frontend/src/pages/downloadFile.js +++ b/safeshare/safeshare-frontend/src/pages/downloadFile.js @@ -24,7 +24,7 @@ function DownloadFile() { // Create a temporary anchor element for downloading the file const a = document.createElement('a'); a.href = url; - a.download = 'downloaded-file.txt'; // Specify the filename + a.download = response.data.filename; a.click(); // Revoke the URL to release resources diff --git a/safeshare/safeshare-frontend/src/pages/shareFile.js b/safeshare/safeshare-frontend/src/pages/shareFile.js index 6f30853..168cca1 100644 --- a/safeshare/safeshare-frontend/src/pages/shareFile.js +++ b/safeshare/safeshare-frontend/src/pages/shareFile.js @@ -9,10 +9,12 @@ function ShareFile() { const handleFileUpload = (file) => { setFile(file); - setPasscode('1234'); + //setPasscode('1234'); + console.log(file); if (file) { const formData = new FormData(); formData.append('files', file); + formData.append('ttl', "2"); // Send POST request to the backend API using Axios axios.post('http://127.0.0.1:8000/api/files/', formData)