Fix API response format compatibility on main page

The streams API now returns standardized format { success: true, data: [...] }
but the frontend was still expecting the old direct array format.

Added backward compatibility to handle both response formats:
- New format: { success: true, data: streams }
- Old format: streams (direct array)

Fixes TypeError: streams.forEach is not a function

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Decobus 2025-07-22 14:25:46 -04:00
parent 8d3a6381cb
commit cbf8cd6516

View file

@ -80,7 +80,9 @@ export default function Home() {
activeRes.json() activeRes.json()
]); ]);
setStreams(streamsData); // Handle both old and new API response formats
const streams = streamsData.success ? streamsData.data : streamsData;
setStreams(streams);
setActiveSources(activeData); setActiveSources(activeData);
} catch (error) { } catch (error) {
console.error('Error fetching data:', error); console.error('Error fetching data:', error);