Skip to content

Commit

Permalink
fix: query string sports_id -> sport_id
Browse files Browse the repository at this point in the history
  • Loading branch information
seongminn committed Nov 30, 2023
1 parent 8b82d45 commit f91c8c3
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/api/match.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ import { convertObjectToQueryString } from '@/utils/queryString';
import instance from '.';

export type MatchListParams = {
sportsId?: string[];
sport_id?: string[];
status: MatchStatus;
leagueId?: string;
league_id?: string;
cursor?: number;
};

Expand Down
2 changes: 1 addition & 1 deletion src/constants/queryParams.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export const QUERY_PARAMS = {
league: 'league_id',
sports: 'sports_id',
sports: 'sport_id',
status: 'status',
};
2 changes: 1 addition & 1 deletion src/queries/useMatchList/Fetcher.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export default function MatchListFetcher({
...props
}: MatchListFetcherProps) {
const { matchList, error, hasNextPage, fetchNextPage, isFetching } =
useMatchList(props satisfies { status: string });
useMatchList(props);

if (error) throw error;

Expand Down
10 changes: 5 additions & 5 deletions src/queries/useMatchList/query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@ import { useSuspenseInfiniteQuery } from '@tanstack/react-query';
import { getMatchList, MatchListParams } from '@/api/match';

export const useMatchList = ({
sportsId,
sport_id,
status = 'playing',
leagueId,
league_id,
}: Omit<MatchListParams, 'cursor' | 'size'>) => {
const { data, error, isFetching, hasNextPage, fetchNextPage } =
useSuspenseInfiniteQuery({
queryKey: ['match-list', sportsId, status, leagueId],
queryKey: ['match-list', sport_id, status, league_id],
queryFn: ({ pageParam }) =>
getMatchList({
sportsId,
sport_id,
status,
leagueId,
league_id,
cursor: pageParam,
}),
initialPageParam: 0,
Expand Down

0 comments on commit f91c8c3

Please sign in to comment.