diff --git a/src/admin/vote/Answers.jsx b/src/admin/vote/Answers.jsx index 6913d43..c785c1a 100644 --- a/src/admin/vote/Answers.jsx +++ b/src/admin/vote/Answers.jsx @@ -17,11 +17,10 @@ export default function Answers() { const [loading, setLoading] = React.useState(true); - const search = new URLSearchParams(window.location.search).get("search"); - const grade = new URLSearchParams(window.location.search).get("grade"); - const listIndex = new URLSearchParams(window.location.search).get( - "listIndex" - ); + const searchParams = new URLSearchParams(window.location.search); + const search = searchParams.get("search"); + const grade = searchParams.get("grade"); + const listIndex = searchParams.get("listIndex"); const [mode, setMode] = React.useState( search || grade || listIndex ? "by-name" : "by-option"