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/app/page.tsx b/src/app/page.tsx index 91a3644..b1709ce 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -22,10 +22,10 @@ export default function Home() { return (
에러
} + errorFallback={() => } loadingFallback={} > - + {data => (
{sportsName} {gameName} diff --git a/src/components/common/Sidebar/index.tsx b/src/components/common/Sidebar/index.tsx index 6dc9347..c14db54 100644 --- a/src/components/common/Sidebar/index.tsx +++ b/src/components/common/Sidebar/index.tsx @@ -52,7 +52,7 @@ export default function Sidebar({ diff --git a/src/components/match/CommentForm/index.tsx b/src/components/match/CommentForm/index.tsx index e604f61..9c16c4f 100644 --- a/src/components/match/CommentForm/index.tsx +++ b/src/components/match/CommentForm/index.tsx @@ -13,8 +13,8 @@ type CommentFormProps = { const teamColor = [ 'bg-cheer-left', - 'bg-[#fb923c] ', 'bg-cheer-right', + 'bg-[#fb923c] ', 'bg-[#22c55e]', ] as const; @@ -25,7 +25,9 @@ export default function CommentForm({ scrollToBottom, }: CommentFormProps) { const [inputValue, setInputValue] = useState(''); - const [selectedTeamId, setSelectedTeamId] = useState(1); + const [selectedTeamId, setSelectedTeamId] = useState( + matchTeams[0].gameTeamId, + ); const handleCommentSubmit = ( e: FormEvent, 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, diff --git a/src/queries/useSportsListByLeagueId/Fetcher.tsx b/src/queries/useSportsListByLeagueId/Fetcher.tsx index 37c063a..b36efd9 100644 --- a/src/queries/useSportsListByLeagueId/Fetcher.tsx +++ b/src/queries/useSportsListByLeagueId/Fetcher.tsx @@ -9,28 +9,13 @@ type SportsListFetcherProps = { children: (data: SportsType[]) => ReactNode; }; -const DUMMY = [ - { - sportId: 1, - name: '축구', - }, - { - sportId: 3, - name: '농구', - }, - { - sportId: 2, - name: '롤', - }, -]; - export default function SportsListFetcher({ leagueId, children, }: SportsListFetcherProps) { - const { error } = useSportsListByLeagueId(leagueId); + const { sportsList, error } = useSportsListByLeagueId(leagueId); if (error) throw error; - return children(DUMMY); + return children(sportsList); }