Skip to content

Commit fc8fec9

Browse files
committed
#4087 moved filtering into frontend
1 parent e9a0de5 commit fc8fec9

2 files changed

Lines changed: 3 additions & 9 deletions

File tree

src/frontend/src/hooks/teams.hooks.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -199,10 +199,3 @@ export const useMyTeamAsHead = () => {
199199
return data;
200200
});
201201
};
202-
203-
export const useTeamsByTypeId = (teamTypeId: string) => {
204-
return useQuery<TeamPreview[], Error>(['teams', 'type', teamTypeId], async () => {
205-
const { data } = await getAllTeams();
206-
return data.filter((team) => team.teamType?.teamTypeId === teamTypeId);
207-
});
208-
};

src/frontend/src/pages/GuestDivisionPage/GuestTeamPage.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,16 @@ import ErrorPage from '../ErrorPage';
33
import { Box, useMediaQuery } from '@mui/system';
44
import PageLayout from '../../components/PageLayout';
55
import GuestSubteamCard from './GuestSubteamCard';
6-
import { useTeamsByTypeId } from '../../hooks/teams.hooks';
6+
import { useAllTeams } from '../../hooks/teams.hooks';
77

88
interface GuestTeamPageProps {
99
teamTypeId: string;
1010
}
1111

1212
const GuestTeamPage: React.FC<GuestTeamPageProps> = ({ teamTypeId }) => {
1313
const isMobilePortrait = useMediaQuery('(max-width:480px)');
14-
const { isLoading: teamsIsLoading, isError: teamsIsError, data: teams, error: teamsError } = useTeamsByTypeId(teamTypeId);
14+
const { isLoading: teamsIsLoading, isError: teamsIsError, data: allTeams, error: teamsError } = useAllTeams();
15+
const teams = allTeams?.filter((team) => team.teamType?.teamTypeId === teamTypeId);
1516

1617
if (teamsIsLoading || !teams) return <LoadingIndicator />;
1718
if (teamsIsError) return <ErrorPage message={teamsError.message} />;

0 commit comments

Comments
 (0)