From e80aca5e6046e7014f0bf6264e2ccef1bbabb897 Mon Sep 17 00:00:00 2001 From: Greg Shuflin Date: Sun, 2 Feb 2025 11:36:15 -0800 Subject: [PATCH] load feeds --- static/js/app.js | 23 ++++++++++++++++++++--- templates/index.html.tera | 2 +- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/static/js/app.js b/static/js/app.js index f39da53..73ece8f 100644 --- a/static/js/app.js +++ b/static/js/app.js @@ -1,3 +1,21 @@ +// Fetch and display feeds +async function fetchFeeds() { + try { + const response = await fetch('/feeds'); + if (response.ok) { + const feeds = await response.json(); + console.log('Feeds loaded:', feeds); + } else { + console.error('Failed to load feeds:', response.status); + } + } catch (error) { + console.error('Error loading feeds:', error); + } +} + +// Load feeds when page loads +document.addEventListener('DOMContentLoaded', fetchFeeds); + // Logout functionality document.getElementById('logoutButton').addEventListener('click', async () => { try { @@ -82,9 +100,8 @@ confirmButton.addEventListener('click', async () => { if (response.ok) { hideModal(); - // TODO: Update the feed list in the UI - // For now, we'll just reload the page - window.location.reload(); + // Refresh the feed list + fetchFeeds(); } else { switch (response.status) { case 409: diff --git a/templates/index.html.tera b/templates/index.html.tera index 22a1f9d..61f1d57 100644 --- a/templates/index.html.tera +++ b/templates/index.html.tera @@ -42,7 +42,7 @@