fix: update server components to match API response structure

- 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 <noreply@anthropic.com>
This commit is contained in:
Justin Edmund 2025-09-02 20:41:45 -07:00
parent 8ea7c95446
commit 59bd37e806
3 changed files with 13 additions and 13 deletions

View file

@ -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
}
}

View file

@ -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 (

View file

@ -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
}
};