diff --git a/frontend/src/appComponents/QuizPage.tsx b/frontend/src/appComponents/QuizPage.tsx index c3035aa..d330a44 100644 --- a/frontend/src/appComponents/QuizPage.tsx +++ b/frontend/src/appComponents/QuizPage.tsx @@ -24,12 +24,10 @@ export default function QuizPage() { const { id } = useParams<{ id: string }>(); const navigate = useNavigate(); + useEffect(() => { if (userId && secretCode != "") { fetchQuiz(); - } else { - console.log("userId", userId); - console.log("secretCode", secretCode); } }, [userId]); @@ -43,8 +41,6 @@ export default function QuizPage() { }, ); const data = response.data; - console.log("data"); - console.log(data); setQuiz(data); setUserAnswers({}); } catch (error) { @@ -81,7 +77,9 @@ export default function QuizPage() { correctAnswers++; } }); - const finalScore = quiz ? (correctAnswers / quiz.questions.length) * 100 : 0; + const finalScore = quiz + ? (correctAnswers / quiz.questions.length) * 100 + : 0; setScore(finalScore); axios @@ -97,7 +95,8 @@ export default function QuizPage() { "Content-Type": "application/json", }, }, - ).then(() => { + ) + .then(() => { alert("Quiz submitted successfully"); navigate("/"); }) @@ -108,100 +107,134 @@ export default function QuizPage() { if (!userId) { return ( -