diff --git a/public/js/texts.js b/public/js/texts.js index 9421c20..1937749 100644 --- a/public/js/texts.js +++ b/public/js/texts.js @@ -5,7 +5,12 @@ document.addEventListener('DOMContentLoaded', () => { async function loadTexts() { const res = await fetch('/api/texts'); const texts = await res.json(); - textsList.innerHTML = texts.map(text => '
  • ' + text.name + '
  • ').join(''); + textsList.innerHTML = texts.map(text => + '
  • ' + + text.name + + '
  • ').join(''); } form.addEventListener('submit', async (e) => { @@ -18,7 +23,10 @@ document.addEventListener('DOMContentLoaded', () => { if (res.ok) { const text = await res.json(); const li = document.createElement('li'); - li.textContent = text.name; + const a = document.createElement('a'); + a.href = '/admin/texts/' + text.id; + a.textContent = text.name; + li.appendChild(a); textsList.appendChild(li); form.reset(); }