From 8c2de2c66b7d68ca5cd50142d7398686bb4c3813 Mon Sep 17 00:00:00 2001 From: Decobus Date: Tue, 22 Jul 2025 14:53:57 -0400 Subject: [PATCH] Remove backwards compatibility for API responses MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Clean up all backward compatibility checks for old API format - All endpoints now consistently return { success: true, data: [...] } - Simplify response handling across all components and pages 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- app/edit/[id]/page.tsx | 3 +-- app/page.tsx | 8 ++------ app/streams/page.tsx | 5 ++--- app/teams/page.tsx | 4 +--- components/Footer.tsx | 4 +--- 5 files changed, 7 insertions(+), 17 deletions(-) diff --git a/app/edit/[id]/page.tsx b/app/edit/[id]/page.tsx index 4422a66..706fc12 100644 --- a/app/edit/[id]/page.tsx +++ b/app/edit/[id]/page.tsx @@ -65,8 +65,7 @@ export default function EditStream() { team_id: streamData.team_id, }); - // Handle both old and new API response formats - const teams = teamsData.success ? teamsData.data : teamsData; + const teams = teamsData.data; // Map teams for dropdown setTeams( diff --git a/app/page.tsx b/app/page.tsx index e90a6a5..b99c179 100644 --- a/app/page.tsx +++ b/app/page.tsx @@ -80,12 +80,8 @@ export default function Home() { activeRes.json() ]); - // Handle both old and new API response formats - const streams = streamsData.success ? streamsData.data : streamsData; - const activeSources = activeData.success ? activeData.data : activeData; - - setStreams(streams); - setActiveSources(activeSources); + setStreams(streamsData.data); + setActiveSources(activeData); } catch (error) { console.error('Error fetching data:', error); showError('Failed to Load Data', 'Could not fetch streams. Please refresh the page.'); diff --git a/app/streams/page.tsx b/app/streams/page.tsx index 8520c19..2f23e7c 100644 --- a/app/streams/page.tsx +++ b/app/streams/page.tsx @@ -40,9 +40,8 @@ export default function AddStream() { const teamsData = await teamsResponse.json(); const streamsData = await streamsResponse.json(); - // Handle both old and new API response formats - const teams = teamsData.success ? teamsData.data : teamsData; - const streams = streamsData.success ? streamsData.data : streamsData; + const teams = teamsData.data; + const streams = streamsData.data; // Map the API data to the format required by the Dropdown setTeams( diff --git a/app/teams/page.tsx b/app/teams/page.tsx index 7b877e4..bb8684a 100644 --- a/app/teams/page.tsx +++ b/app/teams/page.tsx @@ -41,9 +41,7 @@ export default function Teams() { try { const res = await fetch('/api/teams'); const data = await res.json(); - // Handle both old and new API response formats - const teams = data.success ? data.data : data; - setTeams(teams); + setTeams(data.data); } catch (error) { console.error('Error fetching teams:', error); } finally { diff --git a/components/Footer.tsx b/components/Footer.tsx index 3d4328c..b3f4b2f 100644 --- a/components/Footer.tsx +++ b/components/Footer.tsx @@ -50,9 +50,7 @@ export default function Footer() { try { const response = await fetch('/api/counts'); const data = await response.json(); - // Handle both old and new API response formats - const countsData = data.success ? data.data : data; - setCounts(countsData); + setCounts(data.data); } catch (error) { console.error('Failed to fetch counts:', error); }