From 2c3cad528a247c771bca136466337877f76f280f Mon Sep 17 00:00:00 2001 From: Adam Mathes Date: Thu, 12 Feb 2026 21:59:55 -0800 Subject: Implement Frontend Feed List with tests --- frontend/src/components/FeedList.tsx | 50 ++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 frontend/src/components/FeedList.tsx (limited to 'frontend/src/components/FeedList.tsx') diff --git a/frontend/src/components/FeedList.tsx b/frontend/src/components/FeedList.tsx new file mode 100644 index 0000000..fb7c1de --- /dev/null +++ b/frontend/src/components/FeedList.tsx @@ -0,0 +1,50 @@ +import { useEffect, useState } from 'react'; +import type { Feed } from '../types'; +import './FeedList.css'; + +export default function FeedList() { + const [feeds, setFeeds] = useState([]); + const [loading, setLoading] = useState(true); + const [error, setError] = useState(''); + + useEffect(() => { + fetch('/api/feed/') + .then((res) => { + if (!res.ok) { + throw new Error('Failed to fetch feeds'); + } + return res.json(); + }) + .then((data) => { + setFeeds(data); + setLoading(false); + }) + .catch((err) => { + setError(err.message); + setLoading(false); + }); + }, []); + + if (loading) return
Loading feeds...
; + if (error) return
Error: {error}
; + + return ( +
+

Feeds

+ {feeds.length === 0 ? ( +

No feeds found.

+ ) : ( + + )} +
+ ); +} -- cgit v1.2.3