Closed AnsonH closed 2 years ago
The page will display 404 page not found if the following steps are performed:
localhost:3000
/courses
/semesters/:semesterId/courses
https://user-images.githubusercontent.com/57580593/194092348-ab7ce3e0-b20e-4897-8863-ef7a740e1c5a.mp4
The problem comes from the following code snippet:
https://github.com/ZINC-FYP-2022-23/console/blob/80ec42d576dd13275b9ffe04900c43967bd2ad94/components/SemesterSelectMenu.tsx#L68-L79
Only the following paths exist:
/semesters/:semesterId
/semesters/:semesterId/assignments
However, the above code snippet can generate paths such as:
/semesters/:semesterId/admin/courses
/semesters/:semesterId/admin/users
Description
The page will display 404 page not found if the following steps are performed:
localhost:3000
)/courses
)/semesters/:semesterId/courses
)https://user-images.githubusercontent.com/57580593/194092348-ab7ce3e0-b20e-4897-8863-ef7a740e1c5a.mp4
Solution
The problem comes from the following code snippet:
https://github.com/ZINC-FYP-2022-23/console/blob/80ec42d576dd13275b9ffe04900c43967bd2ad94/components/SemesterSelectMenu.tsx#L68-L79
Only the following paths exist:
/semesters/:semesterId
/semesters/:semesterId/assignments
However, the above code snippet can generate paths such as:
/semesters/:semesterId/courses
/semesters/:semesterId/admin/courses
/semesters/:semesterId/admin/users