diff --git a/apps/hackathon/src/app/dashboard/page.tsx b/apps/hackathon/src/app/dashboard/page.tsx index e14b7ba..27a597e 100644 --- a/apps/hackathon/src/app/dashboard/page.tsx +++ b/apps/hackathon/src/app/dashboard/page.tsx @@ -131,8 +131,7 @@ const DashboardPage: FC = (): ReactElement => { {myTeams.length > 0 ? ( (() => { - const item = myTeams[0] as any; - const team = item.team || item; + const team = myTeams[0] as any; return (

diff --git a/apps/hackathon/src/app/users/[userId]/page.tsx b/apps/hackathon/src/app/users/[userId]/page.tsx index 76f7ff1..ac13860 100644 --- a/apps/hackathon/src/app/users/[userId]/page.tsx +++ b/apps/hackathon/src/app/users/[userId]/page.tsx @@ -131,61 +131,58 @@ const UserProfilePage: FC = (): ReactElement => { Team

- {userTeams.map((item: any) => { - const team = item.team || item; - return ( - - {team.name} -
-
- {team.logo ? ( - {team.name} - ) : ( -
- -
- )} -
-

- {team.name} -

-
- {team.has_submission && ( - - - Submitted - - )} - {team.city && ( - - - {team.city} - - )} -
+ {userTeams.map((team: any) => ( + + {team.name} +
+
+ {team.logo ? ( + {team.name} + ) : ( +
+ +
+ )} +
+

+ {team.name} +

+
+ {team.has_submission && ( + + + Submitted + + )} + {team.city && ( + + + {team.city} + + )}
- {team.description && ( -

- {team.description} -

- )}
- - ); - })} + {team.description && ( +

+ {team.description} +

+ )} +
+ + ))}
) : ( diff --git a/libs/service/src/hooks/teams/index.ts b/libs/service/src/hooks/teams/index.ts index b0cf0f3..57626a5 100644 --- a/libs/service/src/hooks/teams/index.ts +++ b/libs/service/src/hooks/teams/index.ts @@ -434,8 +434,11 @@ export const useMyTeams = () => { return useQuery({ queryKey: teamKeys.myTeams(), queryFn: async () => { - const response = await hackathonApi.get>('/teams/my'); - return { data: response.data.data || [] }; + const response = await hackathonApi.get>('/teams/my'); + const rawData = response.data.data || []; + // Unwrap nested team data if present (API returns [{team: {...}}] or [{id, name, ...}]) + const teams = rawData.map((item: any) => item.team || item); + return { data: teams }; }, enabled: !!session?.user?.id, }); @@ -555,8 +558,11 @@ export const useTeamsByUserId = (userId: string) => { return useQuery({ queryKey: ['teams-by-user', userId], queryFn: async () => { - const response = await hackathonApi.get>(`/users/${userId}/teams`); - return { data: response.data.data || [] }; + const response = await hackathonApi.get>(`/users/${userId}/teams`); + const rawData = response.data.data || []; + // Unwrap nested team data if present (API returns [{team: {...}}] or [{id, name, ...}]) + const teams = rawData.map((item: any) => item.team || item); + return { data: teams }; }, enabled: !!userId, });