diff --git a/frontend/src/components/Article/ArticleDetail/ArticleDetail.jsx b/frontend/src/components/Article/ArticleDetail/ArticleDetail.jsx index 0d6150e..af99fe7 100644 --- a/frontend/src/components/Article/ArticleDetail/ArticleDetail.jsx +++ b/frontend/src/components/Article/ArticleDetail/ArticleDetail.jsx @@ -55,7 +55,7 @@ export default function ArticleDetail({
{answer}
diff --git a/frontend/src/components/Article/ArticleDetail/ArticleDetailAnswer/ArticleDetailAnswerInput.jsx b/frontend/src/components/Article/ArticleDetail/ArticleDetailAnswer/ArticleDetailAnswerInput.jsx index 284401a..57e4b3f 100644 --- a/frontend/src/components/Article/ArticleDetail/ArticleDetailAnswer/ArticleDetailAnswerInput.jsx +++ b/frontend/src/components/Article/ArticleDetail/ArticleDetailAnswer/ArticleDetailAnswerInput.jsx @@ -1,16 +1,23 @@ import styles from './ArticleDetailAnswerInput.module.css'; import { useAnswerWrite } from '../../../../hooks/api/useAnswerWrite'; +import { useAnswerEdit } from '../../../../hooks/api/useAnswerEdit'; import { useParams } from 'react-router-dom'; import { useState } from 'react'; -export default function ArticleDetailAnswerInput({ onSubmit, initialAnswer }) { +export default function ArticleDetailAnswerInput({ onSubmit, initialAnswer, isEditing = false }) { const { answerWrite } = useAnswerWrite(); + const { answerEdit } = useAnswerEdit(); const { questionId } = useParams(); const [newAnswer, setNewAnswer] = useState(initialAnswer); const handleSubmit = async (e) => { e.preventDefault(); - await answerWrite(questionId, newAnswer); + console.log(isEditing); + if (isEditing) { + await answerEdit(questionId, newAnswer); + } else { + await answerWrite(questionId, newAnswer); + } onSubmit(newAnswer); }; diff --git a/frontend/src/pages/QuestionListPage/QuestionListPage.jsx b/frontend/src/pages/QuestionListPage/QuestionListPage.jsx index b81a1d8..c262638 100644 --- a/frontend/src/pages/QuestionListPage/QuestionListPage.jsx +++ b/frontend/src/pages/QuestionListPage/QuestionListPage.jsx @@ -9,7 +9,6 @@ export default function QuestionListPage() { const { data } = useQnas(lectureId); const questions = data?.data; const userType = useBoundStore((state) => state.userType); - return (