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:
parent
8ea7c95446
commit
59bd37e806
3 changed files with 13 additions and 13 deletions
|
|
@ -61,12 +61,12 @@ export default async function ProfilePage({
|
||||||
// Prepare data for client component
|
// Prepare data for client component
|
||||||
const initialData = {
|
const initialData = {
|
||||||
user: userData.user,
|
user: userData.user,
|
||||||
teams: teamsData.parties || [],
|
teams: teamsData.results || [],
|
||||||
raidGroups: raidGroupsData.raid_groups || [],
|
raidGroups: raidGroupsData || [],
|
||||||
pagination: {
|
pagination: {
|
||||||
current_page: teamsData.pagination?.current_page || 1,
|
current_page: page,
|
||||||
total_pages: teamsData.pagination?.total_pages || 1,
|
total_pages: teamsData.meta?.total_pages || 1,
|
||||||
record_count: teamsData.pagination?.record_count || 0
|
record_count: teamsData.meta?.count || 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@ export default async function SavedPage({
|
||||||
])
|
])
|
||||||
|
|
||||||
// Filter teams by element/raid if needed
|
// Filter teams by element/raid if needed
|
||||||
let filteredTeams = savedTeamsData.parties || [];
|
let filteredTeams = savedTeamsData.results || [];
|
||||||
|
|
||||||
if (element) {
|
if (element) {
|
||||||
filteredTeams = filteredTeams.filter(party => party.element === element)
|
filteredTeams = filteredTeams.filter(party => party.element === element)
|
||||||
|
|
@ -63,8 +63,8 @@ export default async function SavedPage({
|
||||||
// Prepare data for client component
|
// Prepare data for client component
|
||||||
const initialData = {
|
const initialData = {
|
||||||
teams: filteredTeams,
|
teams: filteredTeams,
|
||||||
raidGroups: raidGroupsData.raid_groups || [],
|
raidGroups: raidGroupsData || [],
|
||||||
totalCount: savedTeamsData.parties?.length || 0
|
totalCount: savedTeamsData.results?.length || 0
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|
|
||||||
|
|
@ -29,12 +29,12 @@ export default async function TeamsPage({
|
||||||
|
|
||||||
// Prepare data for client component
|
// Prepare data for client component
|
||||||
const initialData = {
|
const initialData = {
|
||||||
teams: teamsData.parties || [],
|
teams: teamsData.results || [],
|
||||||
raidGroups: raidGroupsData.raid_groups || [],
|
raidGroups: raidGroupsData || [],
|
||||||
pagination: {
|
pagination: {
|
||||||
current_page: teamsData.pagination?.current_page || 1,
|
current_page: page,
|
||||||
total_pages: teamsData.pagination?.total_pages || 1,
|
total_pages: teamsData.meta?.total_pages || 1,
|
||||||
record_count: teamsData.pagination?.record_count || 0
|
record_count: teamsData.meta?.count || 0
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue