From 1eaf3f6fa190495af6491e0c7a71517d0d5aaa0b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A0=95=EA=B8=B0=EC=98=81?= Date: Fri, 2 Aug 2024 17:04:48 +0900 Subject: [PATCH 1/5] =?UTF-8?q?feat:=20PasswordChangePage=20=EA=B8=B0?= =?UTF-8?q?=EB=8A=A5=20=EC=97=B0=EA=B2=B0(=EB=AF=B8=EC=99=84=EC=84=B1)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../PasswordChangeForm/PasswordChangeForm.jsx | 15 +++++----- frontend/src/components/QuizForm/QuizCard.jsx | 17 ++++++++++- .../components/QuizForm/QuizCard.module.css | 6 ++++ .../src/components/QuizForm/QuizsetForm.jsx | 29 ++++++++++--------- .../QuizsetDetail/QuizsetDetail.jsx | 20 ++++++++++++- frontend/src/hooks/api/useAuth.js | 12 +++++++- frontend/src/hooks/api/useQuizsetDelete.js | 10 +++++++ frontend/src/hooks/api/useQuizsetEdit.js | 10 +++++++ .../PasswordChangePage/PasswordChangePage.jsx | 9 +++++- .../QuizsetDetailPage/QuizsetDetailPage.jsx | 26 +++++++++++++---- .../QuizsetWritePage/QuizsetWritePage.jsx | 22 +++++++++----- 11 files changed, 138 insertions(+), 38 deletions(-) create mode 100644 frontend/src/hooks/api/useQuizsetDelete.js create mode 100644 frontend/src/hooks/api/useQuizsetEdit.js diff --git a/frontend/src/components/PasswordChangeForm/PasswordChangeForm.jsx b/frontend/src/components/PasswordChangeForm/PasswordChangeForm.jsx index c8b65af..2e9e526 100644 --- a/frontend/src/components/PasswordChangeForm/PasswordChangeForm.jsx +++ b/frontend/src/components/PasswordChangeForm/PasswordChangeForm.jsx @@ -1,13 +1,12 @@ import { useState, useRef } from 'react'; import styles from './PasswordChangeForm.module.css'; -export default function PasswordChangeForm() { +export default function PasswordChangeForm({ onSubmit, onPwError = false }) { const [errorConfirmMessage, setErrorConfirmMessage] = useState(false); const [errorSameMessage, setErrorSameMessage] = useState(false); const currentPasswordRef = useRef(''); const newPasswordRef = useRef(''); const confirmPasswordRef = useRef(''); - const userPassword = '1234'; const handleSubmit = (e) => { e.preventDefault(); @@ -15,13 +14,15 @@ export default function PasswordChangeForm() { const newPassword = newPasswordRef.current.value; const confirmPassword = confirmPasswordRef.current.value; - if (currentPassword === userPassword) { - setErrorSameMessage(false); - } else { - setErrorSameMessage(true); - } if (newPassword === confirmPassword) { setErrorConfirmMessage(false); + onSubmit(currentPassword, newPassword, confirmPassword); + + if (onPwError) { + setErrorSameMessage(true); + } else { + setErrorSameMessage(false); + } } else { setErrorConfirmMessage(true); } diff --git a/frontend/src/components/QuizForm/QuizCard.jsx b/frontend/src/components/QuizForm/QuizCard.jsx index 237299e..a474132 100644 --- a/frontend/src/components/QuizForm/QuizCard.jsx +++ b/frontend/src/components/QuizForm/QuizCard.jsx @@ -1,7 +1,7 @@ import { useState } from 'react'; import styles from './QuizCard.module.css'; -export default function QuizCard({ quiz, index, updateQuiz }) { +export default function QuizCard({ quiz, index, updateQuiz, updateImage, deleteQuiz }) { const [question, setQuestion] = useState(quiz.question || ''); const [answer, setAnswer] = useState(quiz.answer || ''); const [choices, setChoices] = useState(quiz.choices || []); @@ -29,8 +29,17 @@ export default function QuizCard({ quiz, index, updateQuiz }) { } }; + const handleFileChange = (e) => { + const file = e.target.files[0] ?? null; + updateImage(index, file); + }; + return (
+
+ 퀴즈 생성 카드 + deleteQuiz(index)}>X +
))} + + ); } diff --git a/frontend/src/components/QuizForm/QuizCard.module.css b/frontend/src/components/QuizForm/QuizCard.module.css index b290a33..d92197e 100644 --- a/frontend/src/components/QuizForm/QuizCard.module.css +++ b/frontend/src/components/QuizForm/QuizCard.module.css @@ -8,6 +8,12 @@ gap: 8px; } +.header { + display: flex; + flex-direction: row; + justify-content: space-between; +} + .buttonsWrapper { display: flex; flex-direction: row; diff --git a/frontend/src/components/QuizForm/QuizsetForm.jsx b/frontend/src/components/QuizForm/QuizsetForm.jsx index 7bca6cb..21debde 100644 --- a/frontend/src/components/QuizForm/QuizsetForm.jsx +++ b/frontend/src/components/QuizForm/QuizsetForm.jsx @@ -6,23 +6,30 @@ import BackIcon from '/src/assets/icons/back.svg?react'; import { Link } from 'react-router-dom'; export default function QuizsetForm({ headerTitle, topic, to, onSubmit }) { - // TODO: 디자인 만들기 및 스타일 적용 const [title, setTitle] = useState(''); const [quizzes, setQuizzes] = useState([]); - const [imageFile, setImageFile] = useState(null); + const [images, setImages] = useState([]); const handleAddQuiz = () => { setQuizzes([...quizzes, { question: '', answer: '', choices: [] }]); + setImages([...images, null]); }; const updateQuiz = (index, updatedQuiz) => { - const updatedQuizzes = quizzes.map((quiz, i) => (i === index ? updatedQuiz : quiz)); + const updatedQuizzes = quizzes.map((quiz, idx) => (idx === index ? updatedQuiz : quiz)); setQuizzes(updatedQuizzes); }; - const handleFileChange = (e) => { - const file = e.target.files?.[0]; - setImageFile(file); + const updateImage = (index, imageFile) => { + const updatedImages = images.map((img, idx) => (idx === index ? imageFile : img)); + setImages(updatedImages); + }; + + const deleteQuiz = (index) => { + console.log(index); + setQuizzes(quizzes.filter((_, idx) => idx !== index)); + setImages(images.filter((_, idx) => idx !== index)); + console.log(quizzes); }; return ( @@ -39,7 +46,7 @@ export default function QuizsetForm({ headerTitle, topic, to, onSubmit }) {
onSubmit(e, title, quizzes, imageFile)} + onSubmit={(e) => onSubmit(e, title, quizzes, images)} > ))} - - ); } diff --git a/frontend/src/hooks/api/useAuth.js b/frontend/src/hooks/api/useAuth.js index 4bf402f..1d57fbe 100644 --- a/frontend/src/hooks/api/useAuth.js +++ b/frontend/src/hooks/api/useAuth.js @@ -55,5 +55,15 @@ export function useAuth() { .catch((e) => console.log(e)); }; - return { login, logout, userRegister }; + const updatePassword = (currentPw, newPw, newPwCheck) => { + const passwordBody = { + currentPassword: currentPw, + newPassword: newPw, + newPasswordCheckL: newPwCheck, + }; + console.log(passwordBody); + return instance.put(`${API_URL}/user/updatepassword`, passwordBody); + }; + + return { login, logout, userRegister, updatePassword }; } diff --git a/frontend/src/hooks/api/useQuizsetDelete.js b/frontend/src/hooks/api/useQuizsetDelete.js new file mode 100644 index 0000000..3977714 --- /dev/null +++ b/frontend/src/hooks/api/useQuizsetDelete.js @@ -0,0 +1,10 @@ +import instance from '../../utils/axios/instance'; +import { API_URL } from '../../constants'; + +export function useQuizsetDelete() { + const quizsetDelete = (quizsetId) => { + return instance.delete(`${API_URL}/quiz/teacher/${quizsetId}`); + }; + + return { quizsetDelete }; +} diff --git a/frontend/src/hooks/api/useQuizsetEdit.js b/frontend/src/hooks/api/useQuizsetEdit.js new file mode 100644 index 0000000..635f510 --- /dev/null +++ b/frontend/src/hooks/api/useQuizsetEdit.js @@ -0,0 +1,10 @@ +import instance from '../../utils/axios/instance'; +import { API_URL } from '../../constants'; + +export function useQuizsetEdit() { + const quizsetEdit = (quizsetId, quizsetObject) => { + return instance.put(`${API_URL}/lecture/${quizsetId}`, quizsetObject); + }; + + return { quizsetEdit }; +} diff --git a/frontend/src/pages/PasswordChangePage/PasswordChangePage.jsx b/frontend/src/pages/PasswordChangePage/PasswordChangePage.jsx index c9b5cbb..4aef72f 100644 --- a/frontend/src/pages/PasswordChangePage/PasswordChangePage.jsx +++ b/frontend/src/pages/PasswordChangePage/PasswordChangePage.jsx @@ -1,5 +1,12 @@ import { PasswordChangeForm } from '../../components/PasswordChangeForm'; +import { useAuth } from '../../hooks/api/useAuth'; export default function PasswordChangePage() { - return ; + // TODO: 400에러 고치기 + const { updatePassword } = useAuth(); + const handleSubmit = async (currentPw, newPw, newPwCheck) => { + console.log(currentPw, newPw); + await updatePassword(currentPw, newPw, newPwCheck); + }; + return ; } diff --git a/frontend/src/pages/QuizsetDetailPage/QuizsetDetailPage.jsx b/frontend/src/pages/QuizsetDetailPage/QuizsetDetailPage.jsx index 30868b6..3e65ebb 100644 --- a/frontend/src/pages/QuizsetDetailPage/QuizsetDetailPage.jsx +++ b/frontend/src/pages/QuizsetDetailPage/QuizsetDetailPage.jsx @@ -1,11 +1,25 @@ import { useQuizsetDetail } from '../../hooks/api/useQuizsetDetail'; -import { useParams } from 'react-router-dom'; +import { useParams, useNavigate } from 'react-router-dom'; import { QuizsetDetail } from '../../components/QuizsetDetail'; +import { useQuizsetDelete } from '../../hooks/api/useQuizsetDelete'; -export default function QuizsetListPage() { - const { lectureId } = useParams(); - const { data } = useQuizsetDetail(lectureId); - const quizset = data?.data ?? []; +export default function QuizsetDetailPage() { + const navigate = useNavigate(); + const { quizsetId } = useParams(); + const { quizsetDelete } = useQuizsetDelete(); + const { data } = useQuizsetDetail(quizsetId); + const quizset = data.data; console.log(quizset); - return ; + const handleDelete = async () => { + await quizsetDelete(quizsetId); + navigate('..'); + }; + return ( + + ); } diff --git a/frontend/src/pages/QuizsetWritePage/QuizsetWritePage.jsx b/frontend/src/pages/QuizsetWritePage/QuizsetWritePage.jsx index d2eced1..4d85077 100644 --- a/frontend/src/pages/QuizsetWritePage/QuizsetWritePage.jsx +++ b/frontend/src/pages/QuizsetWritePage/QuizsetWritePage.jsx @@ -1,25 +1,31 @@ import { QuizsetForm } from '../../components/QuizForm'; import { useQuizsetWrite } from '../../hooks/api/useQuizsetWrite'; +import { useNavigate } from 'react-router-dom'; export default function QuizsetWritePage() { - // TODO: lecture에서 이미지 전송 성공 후 해당 방법으로 이미지 파일 입력 + const navigate = useNavigate(); const { quizsetWrite } = useQuizsetWrite(); - const handleSubmit = async (e, title, quizzes, imageFile = null) => { + const handleSubmit = async (e, title, quizzes, images = []) => { e.preventDefault(); const quizsetObject = { title, quizzes, }; console.log(quizsetObject); - console.log(imageFile); + console.log(images); const formData = new FormData(); formData.append('quizSetCreateRequest', new Blob([JSON.stringify(quizsetObject)], { type: 'application/json' })); - if (imageFile) { - formData.append('image', imageFile); - } - const response = await quizsetWrite(formData); - console.log(response); + images.forEach((imageFile) => { + if (imageFile) { + formData.append('images', imageFile); + } else { + formData.append('images', new Blob(), { type: 'image/jpg' }); + } + }); + + await quizsetWrite(formData); + navigate('..'); }; return ( Date: Fri, 2 Aug 2024 17:15:46 +0900 Subject: [PATCH 2/5] =?UTF-8?q?design:=20LectureCreatePage=20=EB=94=94?= =?UTF-8?q?=EC=9E=90=EC=9D=B8=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../LectureCreatePage/LectureCreatePage.jsx | 15 +++++++-------- .../pages/LectureEditPage/LectureEditPage.jsx | 16 +++++++--------- 2 files changed, 14 insertions(+), 17 deletions(-) diff --git a/frontend/src/pages/LectureCreatePage/LectureCreatePage.jsx b/frontend/src/pages/LectureCreatePage/LectureCreatePage.jsx index eb03a87..c04565b 100644 --- a/frontend/src/pages/LectureCreatePage/LectureCreatePage.jsx +++ b/frontend/src/pages/LectureCreatePage/LectureCreatePage.jsx @@ -17,13 +17,12 @@ export default function LectureCreatePage() { }; return ( -
-

강의 생성

- -
+ ); } diff --git a/frontend/src/pages/LectureEditPage/LectureEditPage.jsx b/frontend/src/pages/LectureEditPage/LectureEditPage.jsx index 394af55..1875cf6 100644 --- a/frontend/src/pages/LectureEditPage/LectureEditPage.jsx +++ b/frontend/src/pages/LectureEditPage/LectureEditPage.jsx @@ -21,14 +21,12 @@ export default function LecutreEditPage() { }; return ( -
- -
+ ); } From 4c958a68d9b5e26c9de426e0a9ca0fa4cfd6f749 Mon Sep 17 00:00:00 2001 From: FF Date: Sat, 3 Aug 2024 10:10:02 +0900 Subject: [PATCH 3/5] =?UTF-8?q?feat:=20QuizsetWrite=20=EC=B9=B4=EB=93=9C?= =?UTF-8?q?=20=EC=82=AD=EC=A0=9C=EA=B8=B0=EB=8A=A5=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/Layout/LectureLayout.jsx | 40 ++++++++-------- frontend/src/components/QuizForm/QuizCard.jsx | 42 +++++++---------- .../src/components/QuizForm/QuizsetForm.jsx | 47 +++++++------------ .../QuizsetWritePage/QuizsetWritePage.jsx | 29 +++++++++--- 4 files changed, 77 insertions(+), 81 deletions(-) diff --git a/frontend/src/components/Layout/LectureLayout.jsx b/frontend/src/components/Layout/LectureLayout.jsx index 95be0e8..c7164ef 100644 --- a/frontend/src/components/Layout/LectureLayout.jsx +++ b/frontend/src/components/Layout/LectureLayout.jsx @@ -13,26 +13,26 @@ export default function LectureLayout() { const { lectureId } = useParams(); const navigate = useNavigate(); - const { lectureDelete } = useLectureDelete(); - const { data } = useLectureInfo(lectureId); - const lecture = data?.data; - const userType = useBoundStore((state) => state.userType); - const handleDelete = () => { - lectureDelete(lectureId); - navigate('..'); - }; - const lectureData = { - title: lecture.title, - description: lecture.description, - plan: lecture.plan, - startDate: lecture.startDate, - endDate: lecture.endDate, - time: lecture.time, - }; - console.log(lectureData); + // const { lectureDelete } = useLectureDelete(); + // const { data } = useLectureInfo(lectureId); + // const lecture = data?.data; + // const userType = useBoundStore((state) => state.userType); + // const handleDelete = () => { + // lectureDelete(lectureId); + // navigate('..'); + // }; + // const lectureData = { + // title: lecture.title, + // description: lecture.description, + // plan: lecture.plan, + // startDate: lecture.startDate, + // endDate: lecture.endDate, + // time: lecture.time, + // }; + // console.log(lectureData); return ( <> - )} - + */}
}>
- + {/* */} ); } diff --git a/frontend/src/components/QuizForm/QuizCard.jsx b/frontend/src/components/QuizForm/QuizCard.jsx index a474132..1468076 100644 --- a/frontend/src/components/QuizForm/QuizCard.jsx +++ b/frontend/src/components/QuizForm/QuizCard.jsx @@ -1,15 +1,18 @@ import { useState } from 'react'; import styles from './QuizCard.module.css'; -export default function QuizCard({ quiz, index, updateQuiz, updateImage, deleteQuiz }) { +export default function QuizCard({ quiz, updateQuiz, deleteQuiz }) { const [question, setQuestion] = useState(quiz.question || ''); const [answer, setAnswer] = useState(quiz.answer || ''); const [choices, setChoices] = useState(quiz.choices || []); + const [imageFile, setImageFile] = useState(quiz.imageFile || null); const handleChoiceChange = (num, content) => { - const updatedChoices = choices.map((choice) => (choice.num === num ? { ...choice, content } : choice)); + const updatedChoices = choices.map((choice) => + choice.num === num ? { ...choice, content } : choice + ); setChoices(updatedChoices); - updateQuiz(index, { question, answer, choices: updatedChoices }); + updateQuiz(quiz.id, { ...quiz, question, answer, choices: updatedChoices, imageFile }); }; const handleAddChoice = () => { @@ -17,7 +20,7 @@ export default function QuizCard({ quiz, index, updateQuiz, updateImage, deleteQ const newChoice = { num: choices.length + 1, content: '' }; const updatedChoices = [...choices, newChoice]; setChoices(updatedChoices); - updateQuiz(index, { question, answer, choices: updatedChoices }); + updateQuiz(quiz.id, { ...quiz, question, answer, choices: updatedChoices, imageFile }); } }; @@ -25,20 +28,21 @@ export default function QuizCard({ quiz, index, updateQuiz, updateImage, deleteQ if (choices.length > 0) { const updatedChoices = choices.slice(0, -1); setChoices(updatedChoices); - updateQuiz(index, { question, answer, choices: updatedChoices }); + updateQuiz(quiz.id, { ...quiz, question, answer, choices: updatedChoices, imageFile }); } }; const handleFileChange = (e) => { const file = e.target.files[0] ?? null; - updateImage(index, file); + setImageFile(file); + updateQuiz(quiz.id, { ...quiz, question, answer, choices, imageFile: file }); }; return (
퀴즈 생성 카드 - deleteQuiz(index)}>X + deleteQuiz(quiz.id)}>X {/* id를 기반으로 삭제 */}
{ setQuestion(e.target.value); - updateQuiz(index, { question: e.target.value, answer, choices }); + updateQuiz(quiz.id, { ...quiz, question: e.target.value, answer, choices, imageFile }); }} placeholder="질문 내용을 입력하세요" /> @@ -56,7 +60,7 @@ export default function QuizCard({ quiz, index, updateQuiz, updateImage, deleteQ value={answer} onChange={(e) => { setAnswer(e.target.value); - updateQuiz(index, { question, answer: e.target.value, choices }); + updateQuiz(quiz.id, { ...quiz, question, answer: e.target.value, choices, imageFile }); }} placeholder="정답을 입력하세요" /> @@ -64,18 +68,10 @@ export default function QuizCard({ quiz, index, updateQuiz, updateImage, deleteQ Tip: 선택지를 넣지 않는다면 단답형 문제가 됩니다
- -
@@ -91,11 +87,7 @@ export default function QuizCard({ quiz, index, updateQuiz, updateImage, deleteQ ))} - + ); -} +} \ No newline at end of file diff --git a/frontend/src/components/QuizForm/QuizsetForm.jsx b/frontend/src/components/QuizForm/QuizsetForm.jsx index 21debde..b06be51 100644 --- a/frontend/src/components/QuizForm/QuizsetForm.jsx +++ b/frontend/src/components/QuizForm/QuizsetForm.jsx @@ -8,37 +8,31 @@ import { Link } from 'react-router-dom'; export default function QuizsetForm({ headerTitle, topic, to, onSubmit }) { const [title, setTitle] = useState(''); const [quizzes, setQuizzes] = useState([]); - const [images, setImages] = useState([]); + const [quizId, setQuizId] = useState(0); const handleAddQuiz = () => { - setQuizzes([...quizzes, { question: '', answer: '', choices: [] }]); - setImages([...images, null]); + setQuizzes([ + ...quizzes, + { id: quizId, question: '', answer: '', choices: [], imageFile: null }, + ]); + setQuizId(quizId + 1); }; - const updateQuiz = (index, updatedQuiz) => { - const updatedQuizzes = quizzes.map((quiz, idx) => (idx === index ? updatedQuiz : quiz)); + const updateQuiz = (id, updatedQuiz) => { + const updatedQuizzes = quizzes.map((quiz) => + quiz.id === id ? updatedQuiz : quiz + ); setQuizzes(updatedQuizzes); }; - const updateImage = (index, imageFile) => { - const updatedImages = images.map((img, idx) => (idx === index ? imageFile : img)); - setImages(updatedImages); - }; - - const deleteQuiz = (index) => { - console.log(index); - setQuizzes(quizzes.filter((_, idx) => idx !== index)); - setImages(images.filter((_, idx) => idx !== index)); - console.log(quizzes); + const deleteQuiz = (id) => { + setQuizzes(quizzes.filter((quiz) => quiz.id !== id)); }; return (
- + {headerTitle} @@ -46,7 +40,7 @@ export default function QuizsetForm({ headerTitle, topic, to, onSubmit }) {
onSubmit(e, title, quizzes, images)} + onSubmit={(e) => onSubmit(e, title, quizzes)} > setTitle(e.target.value)} placeholder="퀴즈셋 제목을 입력해주세요" /> - {quizzes.map((quiz, index) => ( + {quizzes.map((quiz) => ( ))} @@ -71,14 +63,11 @@ export default function QuizsetForm({ headerTitle, topic, to, onSubmit }) { > 퀴즈 추가하기 -
); -} +} \ No newline at end of file diff --git a/frontend/src/pages/QuizsetWritePage/QuizsetWritePage.jsx b/frontend/src/pages/QuizsetWritePage/QuizsetWritePage.jsx index 4d85077..806b00d 100644 --- a/frontend/src/pages/QuizsetWritePage/QuizsetWritePage.jsx +++ b/frontend/src/pages/QuizsetWritePage/QuizsetWritePage.jsx @@ -5,28 +5,43 @@ import { useNavigate } from 'react-router-dom'; export default function QuizsetWritePage() { const navigate = useNavigate(); const { quizsetWrite } = useQuizsetWrite(); - const handleSubmit = async (e, title, quizzes, images = []) => { + + const handleSubmit = async (e, title, quizzes) => { e.preventDefault(); + console.log(quizzes) + + const images = []; + const quizContents = []; + + quizzes.forEach((quiz) => { + const { imageFile, ...quizData } = quiz; + images.push(imageFile); + quizContents.push(quizData); + }); + const quizsetObject = { title, - quizzes, + quizzes: quizContents, }; - console.log(quizsetObject); - console.log(images); const formData = new FormData(); - formData.append('quizSetCreateRequest', new Blob([JSON.stringify(quizsetObject)], { type: 'application/json' })); + formData.append( + 'quizSetCreateRequest', + new Blob([JSON.stringify(quizsetObject)], { type: 'application/json' }) + ); + images.forEach((imageFile) => { if (imageFile) { formData.append('images', imageFile); } else { - formData.append('images', new Blob(), { type: 'image/jpg' }); + formData.append('images', new Blob([''], { type: 'image/jpg' })); } }); await quizsetWrite(formData); navigate('..'); }; + return ( ); -} +} \ No newline at end of file From ef4e56c8608b177f71f241f8680929874e649987 Mon Sep 17 00:00:00 2001 From: FF Date: Sat, 3 Aug 2024 10:11:48 +0900 Subject: [PATCH 4/5] =?UTF-8?q?fix:=20=EC=BD=94=EB=93=9C=20=ED=85=8C?= =?UTF-8?q?=EC=8A=A4=ED=8A=B8=EC=9A=A9=20=EC=A3=BC=EC=84=9D=20=EC=A0=9C?= =?UTF-8?q?=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/Layout/LectureLayout.jsx | 40 +++++++++---------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/frontend/src/components/Layout/LectureLayout.jsx b/frontend/src/components/Layout/LectureLayout.jsx index c7164ef..95be0e8 100644 --- a/frontend/src/components/Layout/LectureLayout.jsx +++ b/frontend/src/components/Layout/LectureLayout.jsx @@ -13,26 +13,26 @@ export default function LectureLayout() { const { lectureId } = useParams(); const navigate = useNavigate(); - // const { lectureDelete } = useLectureDelete(); - // const { data } = useLectureInfo(lectureId); - // const lecture = data?.data; - // const userType = useBoundStore((state) => state.userType); - // const handleDelete = () => { - // lectureDelete(lectureId); - // navigate('..'); - // }; - // const lectureData = { - // title: lecture.title, - // description: lecture.description, - // plan: lecture.plan, - // startDate: lecture.startDate, - // endDate: lecture.endDate, - // time: lecture.time, - // }; - // console.log(lectureData); + const { lectureDelete } = useLectureDelete(); + const { data } = useLectureInfo(lectureId); + const lecture = data?.data; + const userType = useBoundStore((state) => state.userType); + const handleDelete = () => { + lectureDelete(lectureId); + navigate('..'); + }; + const lectureData = { + title: lecture.title, + description: lecture.description, + plan: lecture.plan, + startDate: lecture.startDate, + endDate: lecture.endDate, + time: lecture.time, + }; + console.log(lectureData); return ( <> - {/* )} - */} +
}>
- {/* */} + ); } From 9727b55e0de91bb64611fb652bcbc72cc70f764c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A0=95=EA=B8=B0=EC=98=81?= Date: Mon, 5 Aug 2024 10:18:29 +0900 Subject: [PATCH 5/5] =?UTF-8?q?feat:=20updatePassword,=20updateInfo=20?= =?UTF-8?q?=EA=B8=B0=EB=8A=A5=20=EC=97=B0=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/InfoEditForm/InfoEditForm.jsx | 8 ++++++-- .../PasswordChangeForm/PasswordChangeForm.jsx | 1 + frontend/src/hooks/api/useAuth.js | 12 ++++++++++-- .../src/pages/MyInfoChangePage/MyInfoChangePage.jsx | 12 +++++++++++- frontend/src/utils/axios/instance.js | 2 +- 5 files changed, 29 insertions(+), 6 deletions(-) diff --git a/frontend/src/components/InfoEditForm/InfoEditForm.jsx b/frontend/src/components/InfoEditForm/InfoEditForm.jsx index 4938ea7..447add7 100644 --- a/frontend/src/components/InfoEditForm/InfoEditForm.jsx +++ b/frontend/src/components/InfoEditForm/InfoEditForm.jsx @@ -1,11 +1,15 @@ import styles from './InfoEditForm.module.css'; import { useState } from 'react'; -export default function InfoEditForm() { +export default function InfoEditForm({ onSubmit }) { const [username, setUsername] = useState(''); const [useremail, setUseremail] = useState(''); + return ( -
+ onSubmit(e, username, useremail)} + className={styles.infoEditForm} + >

이름 변경