diff options
Diffstat (limited to '')
| -rw-r--r-- | frontend/src/pages/Maplist.tsx | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/frontend/src/pages/Maplist.tsx b/frontend/src/pages/Maplist.tsx index 9526d18..31b7b2e 100644 --- a/frontend/src/pages/Maplist.tsx +++ b/frontend/src/pages/Maplist.tsx | |||
| @@ -21,7 +21,7 @@ const Maplist: React.FC = () => { | |||
| 21 | 21 | ||
| 22 | const [dropdownActive, setDropdownActive] = React.useState("none"); | 22 | const [dropdownActive, setDropdownActive] = React.useState("none"); |
| 23 | 23 | ||
| 24 | const params = useParams<{ id: string }>(); | 24 | const params = useParams<{ id: string, chapter: string }>(); |
| 25 | const location = useLocation(); | 25 | const location = useLocation(); |
| 26 | const navigate = useNavigate(); | 26 | const navigate = useNavigate(); |
| 27 | 27 | ||
| @@ -52,11 +52,10 @@ const Maplist: React.FC = () => { | |||
| 52 | 52 | ||
| 53 | // location query params | 53 | // location query params |
| 54 | const queryParams = new URLSearchParams(location.search); | 54 | const queryParams = new URLSearchParams(location.search); |
| 55 | if (queryParams.get("cat")) { | 55 | if (queryParams.get("chapter")) { |
| 56 | const cat = parseFloat(queryParams.get("cat") || ""); | 56 | const cat = parseFloat(queryParams.get("chapter") || ""); |
| 57 | setCategory(cat); | 57 | _fetch_chapters(cat.toString()); |
| 58 | setCatNum(cat - 1); | 58 | } |
| 59 | } | ||
| 60 | 59 | ||
| 61 | const _fetch_game = async () => { | 60 | const _fetch_game = async () => { |
| 62 | const games = await API.get_games(); | 61 | const games = await API.get_games(); |
| @@ -80,7 +79,8 @@ const Maplist: React.FC = () => { | |||
| 80 | }, []); | 79 | }, []); |
| 81 | 80 | ||
| 82 | useEffect(() => { | 81 | useEffect(() => { |
| 83 | if (gameChapters != undefined) { | 82 | const queryParams = new URLSearchParams(location.search); |
| 83 | if (gameChapters != undefined && queryParams.get("chapter") == "") { | ||
| 84 | _fetch_chapters(gameChapters!.chapters[0].id.toString()); | 84 | _fetch_chapters(gameChapters!.chapters[0].id.toString()); |
| 85 | } | 85 | } |
| 86 | }, [gameChapters]) | 86 | }, [gameChapters]) |