diff --git a/frontend/src/components/Article/ArticleDetail/ArticleDetail.jsx b/frontend/src/components/Article/ArticleDetail/ArticleDetail.jsx index 83914cc..2d0d420 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 9b90b5c..57ef286 100644 --- a/frontend/src/components/Article/ArticleDetail/ArticleDetailAnswer/ArticleDetailAnswerInput.jsx +++ b/frontend/src/components/Article/ArticleDetail/ArticleDetailAnswer/ArticleDetailAnswerInput.jsx @@ -1,18 +1,24 @@ 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, isEditing = false }) { import SendIcon from '/src/assets/icons/send.svg?react'; - -export default function ArticleDetailAnswerInput({ onSubmit, initialAnswer }) { 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 (