From 0bb18c3a47dcd302e912f38697e842423d5acbc7 Mon Sep 17 00:00:00 2001 From: chchaeun Date: Thu, 13 Oct 2022 22:03:35 +0900 Subject: [PATCH] =?UTF-8?q?Fix:=20=EC=A0=95=EB=8B=B5=20=EB=8D=B0=EC=9D=B4?= =?UTF-8?q?=ED=84=B0=20=EC=98=A4=EB=A5=98=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/quiz-detail/blocks/QuizAnswerBlock.tsx | 10 ++++++++-- components/quiz-detail/containers/QuizNavigation.tsx | 1 - pages/challenges/[cid]/quizzes/[qid]/index.tsx | 2 -- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/components/quiz-detail/blocks/QuizAnswerBlock.tsx b/components/quiz-detail/blocks/QuizAnswerBlock.tsx index 201b208..06880c6 100644 --- a/components/quiz-detail/blocks/QuizAnswerBlock.tsx +++ b/components/quiz-detail/blocks/QuizAnswerBlock.tsx @@ -1,5 +1,6 @@ import { Icon } from "@iconify/react"; -import React, { useState } from "react"; +import { useRouter } from "next/router"; +import React, { useEffect, useState } from "react"; import styled from "styled-components"; import { useQuizDetailQuery } from "../../../api/quizzes/hooks"; import ContentsFormat from "../../../utils/ContentsFormat"; @@ -9,10 +10,15 @@ interface Props { } function QuizAnswerBlock({ quizId }: Props) { + const router = useRouter(); const { data: quizDetail } = useQuizDetailQuery({ quizId }); const [showAnswer, setShowAnswer] = useState(false); + useEffect(() => { + setShowAnswer(false); + }, [router]); + const onAnswerClick = () => { if (quizDetail?.solveAnswer) { setShowAnswer((prev) => !prev); @@ -29,7 +35,7 @@ function QuizAnswerBlock({ quizId }: Props) { 정답 확인 - + diff --git a/components/quiz-detail/containers/QuizNavigation.tsx b/components/quiz-detail/containers/QuizNavigation.tsx index 8130860..1bd5e66 100644 --- a/components/quiz-detail/containers/QuizNavigation.tsx +++ b/components/quiz-detail/containers/QuizNavigation.tsx @@ -2,7 +2,6 @@ import { Icon } from "@iconify/react"; import { useRouter } from "next/router"; import React from "react"; import styled from "styled-components"; -import { fetchQuizzes } from "../../../api/quizzes"; import { useQuizzesQuery } from "../../../api/quizzes/hooks"; import { media } from "../../../styles/media"; diff --git a/pages/challenges/[cid]/quizzes/[qid]/index.tsx b/pages/challenges/[cid]/quizzes/[qid]/index.tsx index 5c6538b..ee8821e 100644 --- a/pages/challenges/[cid]/quizzes/[qid]/index.tsx +++ b/pages/challenges/[cid]/quizzes/[qid]/index.tsx @@ -10,7 +10,6 @@ function QuizDetailPage() { const router = useRouter(); const challengeId = String(router.query.cid); const quizId = String(router.query.qid); - const week = String(router.query.week); return ( @@ -19,7 +18,6 @@ function QuizDetailPage() {