Skip to content

Commit

Permalink
Merge pull request #149 from Learn-and-Give/hotfix/quizAnswerDataError
Browse files Browse the repository at this point in the history
Release/v.1.6.1
  • Loading branch information
chchaeun authored Oct 13, 2022
2 parents fc0c5db + 0bb18c3 commit 9bb7ca5
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
10 changes: 8 additions & 2 deletions components/quiz-detail/blocks/QuizAnswerBlock.tsx
Original file line number Diff line number Diff line change
@@ -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";
Expand All @@ -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);
Expand All @@ -29,7 +35,7 @@ function QuizAnswerBlock({ quizId }: Props) {
<Block>
<Title>정답 확인</Title>
<ContentBox>
<ContentsFormat contents={quizDetail.quizContent} />
<ContentsFormat contents={quizDetail.quizAnswer || ""} />
</ContentBox>
</Block>
<Block>
Expand Down
1 change: 0 additions & 1 deletion components/quiz-detail/containers/QuizNavigation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down
2 changes: 0 additions & 2 deletions pages/challenges/[cid]/quizzes/[qid]/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<Background>
Expand All @@ -19,7 +18,6 @@ function QuizDetailPage() {
<QuizNavigation
challengeId={challengeId}
quizId={quizId}
week={week}
page={"READABLE"}
/>
<QuizCommentContainer quizId={quizId} />
Expand Down

0 comments on commit 9bb7ca5

Please sign in to comment.