diff --git a/components/takgu/game/GameResultList.tsx b/components/takgu/game/GameResultList.tsx index d36f36f03..07d443711 100644 --- a/components/takgu/game/GameResultList.tsx +++ b/components/takgu/game/GameResultList.tsx @@ -13,6 +13,13 @@ interface GameResultListProps { radioMode?: SeasonMode; } +type pageType = 'main' | 'game' | 'profile'; + +const pageTypeMap: Record = { + '/takgu': 'main', + '/takgu/game': 'game', +}; + export default function GameResultList({ path, radioMode, @@ -20,8 +27,7 @@ export default function GameResultList({ const { data, status, fetchNextPage, isLast, clickedGameItem, pathName } = useGameResultList(path); - const page = - pathName === '/' ? 'main' : pathName === '/game' ? 'game' : 'profile'; + const page: pageType = pageTypeMap[pathName] || 'profile'; if (status === 'loading') return ; diff --git a/components/takgu/mode/modeWraps/GameModeWrap.tsx b/components/takgu/mode/modeWraps/GameModeWrap.tsx index ebfa0a25e..a2a17281a 100644 --- a/components/takgu/mode/modeWraps/GameModeWrap.tsx +++ b/components/takgu/mode/modeWraps/GameModeWrap.tsx @@ -40,7 +40,7 @@ export default function GameModeWrap({ setRadioMode(e.target.value as SeasonMode); }; - const isGamePage = useRouter().pathname === '/game'; + const isGamePage = useRouter().pathname === '/takgu/game'; return (