From f91c8c37bcc5c50b3ee910200387c5ef7765da81 Mon Sep 17 00:00:00 2001 From: seongminn Date: Thu, 30 Nov 2023 15:30:14 +0900 Subject: [PATCH] fix: query string sports_id -> sport_id --- src/api/match.ts | 4 ++-- src/constants/queryParams.ts | 2 +- src/queries/useMatchList/Fetcher.tsx | 2 +- src/queries/useMatchList/query.ts | 10 +++++----- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/api/match.ts b/src/api/match.ts index b57a418..2b98ddd 100644 --- a/src/api/match.ts +++ b/src/api/match.ts @@ -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; }; diff --git a/src/constants/queryParams.ts b/src/constants/queryParams.ts index b2a3137..ebb9e7d 100644 --- a/src/constants/queryParams.ts +++ b/src/constants/queryParams.ts @@ -1,5 +1,5 @@ export const QUERY_PARAMS = { league: 'league_id', - sports: 'sports_id', + sports: 'sport_id', status: 'status', }; diff --git a/src/queries/useMatchList/Fetcher.tsx b/src/queries/useMatchList/Fetcher.tsx index 9181a13..3501b49 100644 --- a/src/queries/useMatchList/Fetcher.tsx +++ b/src/queries/useMatchList/Fetcher.tsx @@ -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; diff --git a/src/queries/useMatchList/query.ts b/src/queries/useMatchList/query.ts index 267e0a7..009996d 100644 --- a/src/queries/useMatchList/query.ts +++ b/src/queries/useMatchList/query.ts @@ -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) => { 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,