add home javascript
This commit is contained in:
parent
95ea38acfa
commit
1c2ca21f44
1 changed files with 13 additions and 0 deletions
13
public/js/home.js
Normal file
13
public/js/home.js
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
document.addEventListener('DOMContentLoaded', () => {
|
||||||
|
const textsList = document.getElementById('texts-list');
|
||||||
|
|
||||||
|
async function loadTexts() {
|
||||||
|
const response = await fetch('/api/texts');
|
||||||
|
const texts = await response.json();
|
||||||
|
textsList.innerHTML = texts
|
||||||
|
.map(text => '<li>' + text.name + '</li>')
|
||||||
|
.join('');
|
||||||
|
}
|
||||||
|
|
||||||
|
loadTexts();
|
||||||
|
});
|
||||||
Loading…
Add table
Add a link
Reference in a new issue