Skip to content

Commit

Permalink
Changed few list-of-group-type APIs to newer APIs (#9558)
Browse files Browse the repository at this point in the history
  • Loading branch information
danieljames-dj authored Jun 18, 2024
1 parent 3642bc8 commit 25889b3
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
10 changes: 6 additions & 4 deletions app/webpacker/components/OfficersAndBoard/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,16 @@ import EmailButton from '../EmailButton';

export default function OfficersAndBoard() {
const { data: officers, loading: officersLoading, error: officersError } = useLoadedData(
apiV0Urls.userRoles.listOfGroupType(groupTypes.officers, 'status:desc', {
apiV0Urls.userRoles.list({
isActive: true,
}),
groupType: groupTypes.officers,
}, 'status:desc'),
);
const { data: board, loading: boardLoading, error: boardError } = useLoadedData(
apiV0Urls.userRoles.listOfGroupType(groupTypes.board, 'name', {
apiV0Urls.userRoles.list({
isActive: true,
}),
groupType: groupTypes.board,
}, 'name'),
);

// The same user can hold multiple officer positions, and it won't be good to show same user
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,18 @@ export default function BannedCompetitorsPage() {
loading: bannedCompetitorRolesLoading,
error: bannedCompetitorRolesError,
sync,
} = useLoadedData(apiV0Urls.userRoles.listOfGroupType(groupTypes.banned_competitors, 'startDate', {
} = useLoadedData(apiV0Urls.userRoles.list({
isActive: true,
}));
groupType: groupTypes.banned_competitors,
}, 'startDate'));
const {
data: pastBannedCompetitorRoles,
loading: pastBannedCompetitorRolesLoading,
error: pastBannedCompetitorRolesError,
} = useLoadedData(apiV0Urls.userRoles.listOfGroupType(groupTypes.banned_competitors, 'startDate', {
} = useLoadedData(apiV0Urls.userRoles.list({
isActive: false,
}));
groupType: groupTypes.banned_competitors,
}, 'startDate'));
const {
data: bannedGroups,
loading: bannedGroupLoading,
Expand Down
2 changes: 1 addition & 1 deletion app/webpacker/components/Translators/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import UserBadge from '../UserBadge';
export default function Translators() {
const {
data: translators, loading, error,
} = useLoadedData(apiV0Urls.userRoles.listOfGroupType(groupTypes.translators));
} = useLoadedData(apiV0Urls.userRoles.list({ groupType: groupTypes.translators }));
const groupedTranslators = useMemo(
() => _.groupBy((translators || []), (role) => role.group.id),
[translators],
Expand Down

0 comments on commit 25889b3

Please sign in to comment.