diff --git a/public/js/dashboard.js b/public/js/dashboard.js index 8f8a5045..850011e1 100644 --- a/public/js/dashboard.js +++ b/public/js/dashboard.js @@ -200,6 +200,32 @@ document.getElementById('updateStatistics').addEventListener('click', async () = } }); +document.getElementById('updateShortens').addEventListener('click', async () => { + const resp = await fetch('/api/shortens', { + method: 'GET', + headers: { + 'Content-Type': 'application/json' + } + }); + const json = await resp.json(); + + console.log(json); + try { + document.getElementById('shortensTable').innerHTML = ''; + for (const shorten of json) { + $('#shortensTableShortens').append(` + + ${shorten.id} + ${c.origin} + ${c.url} + + `) + } + } catch (e) { + console.error(e) + } +}); + const deleteImage = (id, url) => {