From 59bd37e80644a6d684eff90f132d63eda527701a Mon Sep 17 00:00:00 2001 From: Justin Edmund Date: Tue, 2 Sep 2025 20:41:45 -0700 Subject: [PATCH] fix: update server components to match API response structure MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Change teamsData.parties to teamsData.results (API returns "results" not "parties") - Change teamsData.pagination to teamsData.meta (API returns "meta" not "pagination") - Map meta.count to record_count for pagination - Use page parameter for current_page instead of expecting it from API - Fix raidGroups to use direct array instead of .raid_groups property Aligns frontend expectations with actual backend API response format 🤖 Generated with Claude Code https://claude.ai/code Co-Authored-By: Claude --- app/[locale]/[username]/page.tsx | 10 +++++----- app/[locale]/saved/page.tsx | 6 +++--- app/[locale]/teams/page.tsx | 10 +++++----- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/app/[locale]/[username]/page.tsx b/app/[locale]/[username]/page.tsx index 815f0f2e..a6ee7f5d 100644 --- a/app/[locale]/[username]/page.tsx +++ b/app/[locale]/[username]/page.tsx @@ -61,12 +61,12 @@ export default async function ProfilePage({ // Prepare data for client component const initialData = { user: userData.user, - teams: teamsData.parties || [], - raidGroups: raidGroupsData.raid_groups || [], + teams: teamsData.results || [], + raidGroups: raidGroupsData || [], pagination: { - current_page: teamsData.pagination?.current_page || 1, - total_pages: teamsData.pagination?.total_pages || 1, - record_count: teamsData.pagination?.record_count || 0 + current_page: page, + total_pages: teamsData.meta?.total_pages || 1, + record_count: teamsData.meta?.count || 0 } } diff --git a/app/[locale]/saved/page.tsx b/app/[locale]/saved/page.tsx index 7656dec5..be5e3230 100644 --- a/app/[locale]/saved/page.tsx +++ b/app/[locale]/saved/page.tsx @@ -50,7 +50,7 @@ export default async function SavedPage({ ]) // Filter teams by element/raid if needed - let filteredTeams = savedTeamsData.parties || []; + let filteredTeams = savedTeamsData.results || []; if (element) { filteredTeams = filteredTeams.filter(party => party.element === element) @@ -63,8 +63,8 @@ export default async function SavedPage({ // Prepare data for client component const initialData = { teams: filteredTeams, - raidGroups: raidGroupsData.raid_groups || [], - totalCount: savedTeamsData.parties?.length || 0 + raidGroups: raidGroupsData || [], + totalCount: savedTeamsData.results?.length || 0 } return ( diff --git a/app/[locale]/teams/page.tsx b/app/[locale]/teams/page.tsx index 43cc4232..bccf7313 100644 --- a/app/[locale]/teams/page.tsx +++ b/app/[locale]/teams/page.tsx @@ -29,12 +29,12 @@ export default async function TeamsPage({ // Prepare data for client component const initialData = { - teams: teamsData.parties || [], - raidGroups: raidGroupsData.raid_groups || [], + teams: teamsData.results || [], + raidGroups: raidGroupsData || [], pagination: { - current_page: teamsData.pagination?.current_page || 1, - total_pages: teamsData.pagination?.total_pages || 1, - record_count: teamsData.pagination?.record_count || 0 + current_page: page, + total_pages: teamsData.meta?.total_pages || 1, + record_count: teamsData.meta?.count || 0 } };