From c55e3df669817bedf93d41bd1c9675523386171a Mon Sep 17 00:00:00 2001 From: xrando <2837341L@student.gla.ac.uk> Date: Thu, 26 Oct 2023 16:41:43 +0800 Subject: [PATCH] added text input to take in ttl added text input to take in ttl --- .../safeshare-frontend/src/pages/shareFile.js | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/safeshare/safeshare-frontend/src/pages/shareFile.js b/safeshare/safeshare-frontend/src/pages/shareFile.js index 2cc6118..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 @@ -62,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 && (