Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add fallback for Team members with no team #238

Merged
merged 1 commit into from
Apr 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/pages/TeamMembers/TeamMembers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const TeamMembers = () => {
text={section_name}
/>
),
team: teams.length,
team: teams?.length ?? 0,
epost: principal_name,
data_admin: groups.filter((group) => group.uniform_name.endsWith('data-admins')).length,
seksjon: section_name, // Makes section name searchable and sortable in table by including the field
Expand Down
4 changes: 2 additions & 2 deletions src/services/teamMembers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ export const fetchManagedUsersManagers = async (principalName: string): Promise<
}
delete prepData._embedded

return prepData
return { ...prepData, teams: prepData.teams?.length ? prepData.teams : [] }
})
)

Expand Down Expand Up @@ -138,7 +138,7 @@ export const fetchAllUsers = async (): Promise<UsersData> => {
...user._embedded,
}
delete prepUserData._embedded
return prepUserData
return { ...prepUserData, teams: prepUserData.teams?.length ? prepUserData.teams : [] }
})
delete prepData._embedded

Expand Down