summaryrefslogtreecommitdiff
path: root/client/fileinfo.js
diff options
context:
space:
mode:
authorAditish51 <adtshukla519@gmail.com>2024-07-22 22:54:12 +0530
committerBlaster4385 <venkatesh@tablaster.dev>2024-07-25 17:15:39 +0530
commit26cf8aa1cbb894ce91e866da1227ea42a92fdfab (patch)
treec4fbb66c741bed69ebaf6102aea0a5359602ab4a /client/fileinfo.js
parent4016aa58005f968cca5b216e4188394b4d350095 (diff)
feat: added initial frontend
Diffstat (limited to 'client/fileinfo.js')
-rw-r--r--client/fileinfo.js36
1 files changed, 36 insertions, 0 deletions
diff --git a/client/fileinfo.js b/client/fileinfo.js
new file mode 100644
index 0000000..2a4d449
--- /dev/null
+++ b/client/fileinfo.js
@@ -0,0 +1,36 @@
+
+const fileInfo = document.querySelector("#fileInfo");
+let link = document.getElementById('link')
+async function getID() {
+ const id = document.getElementById('idInput').value;
+ const apiKey = document.getElementById('keyInput').value;
+
+ const baseURL1 = 'http://localhost:8080/get';
+ const baseURL2 = 'http://localhost:8080/download';
+ const url = `${baseURL1}/${id}?key=${apiKey}`;
+ link.href =`${baseURL2}/${id}?key=${apiKey}` ;
+ try {
+ let response = await fetch(url);
+
+
+ let data = await response.json();
+
+ fileName = data.fileName;
+
+ fileSize = data.fileSize;
+
+
+ fileInfo.innerHTML = `<b>File Name:</b> ${fileName}<br><br></b><b>File Size:</> </b>${fileSize}`;
+ fileInfo.style.display = 'block';
+
+ }
+
+ catch (error) {
+ console.error('Error fetching data:', error);
+
+ }
+}
+
+
+
+