diff --git a/safeshare/safeshare-frontend/src/pages/shareFile.js b/safeshare/safeshare-frontend/src/pages/shareFile.js
index a18f5d1..ce68ce8 100644
--- a/safeshare/safeshare-frontend/src/pages/shareFile.js
+++ b/safeshare/safeshare-frontend/src/pages/shareFile.js
@@ -6,6 +6,7 @@ import { Link } from 'react-router-dom';
function ShareFile() {
const [file, setFile] = useState(null);
const [passcode, setPasscode] = useState('');
+ const [ttl, setTtl] = useState('');
const [shareableLink, setShareableLink] = useState('');
const [notification, setNotification] = useState('');
@@ -16,7 +17,7 @@ function ShareFile() {
if (file) {
const formData = new FormData();
formData.append('file', file);
- //formData.append('ttl', "60");
+ formData.append('ttl', ttl * 24 * 60 * 60);
// Send POST request to the backend API using Axios
axios
@@ -28,7 +29,10 @@ function ShareFile() {
// If data is an array, take the first item
if (Array.isArray(data)) {
const passcode = data[0].key;
+ const baseUrl = 'http://localhost:8000/api/files/';
+
setPasscode(passcode);
+ setShareableLink(baseUrl + passcode);
// Copy the passcode to the clipboard
navigator.clipboard.writeText(passcode).then(() => {
// Show a notification
@@ -40,8 +44,6 @@ function ShareFile() {
// Handle errors here
console.error('File upload failed', error);
});
- const baseUrl = 'http://localhost:3000/download/';
- setShareableLink(baseUrl);
}
};
@@ -61,7 +63,23 @@ function ShareFile() {
Back
Share a file with others!
+
+ {/* TTL Input */}
+
+
+ setTtl(e.target.value)}
+ className="mt-1 p-2 w-full border rounded-md focus:ring focus:ring-opacity-50"
+ />
+
+
+
{passcode && (