From cbf8cd6516872c4d22ba5d516539f5c28140eb84 Mon Sep 17 00:00:00 2001 From: Decobus Date: Tue, 22 Jul 2025 14:25:46 -0400 Subject: [PATCH] Fix API response format compatibility on main page MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- app/page.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/page.tsx b/app/page.tsx index 0e3ff66..a9125b7 100644 --- a/app/page.tsx +++ b/app/page.tsx @@ -80,7 +80,9 @@ export default function Home() { activeRes.json() ]); - setStreams(streamsData); + // Handle both old and new API response formats + const streams = streamsData.success ? streamsData.data : streamsData; + setStreams(streams); setActiveSources(activeData); } catch (error) { console.error('Error fetching data:', error);