-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
21 lines (20 loc) · 853 Bytes
/
script.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
document.addEventListener("DOMContentLoaded", function() {
const pdfList = document.getElementById("pdf-list");
// Fetch the list of PDF files from the API
fetch("https://fastapi-wt2k.onrender.com/pdfs/")
.then(response => response.json())
.then(data => {
const pdfFiles = data.pdf_files;
pdfFiles.forEach(file => {
const listItem = document.createElement("li");
const link = document.createElement("a");
link.href = `https://fastapi-wt2k.onrender.com/pdfs/${file}`;
link.textContent = file;
listItem.appendChild(link);
pdfList.appendChild(listItem);
});
})
.catch(error => {
console.error("Error fetching PDF files:", error);
});
});