From 31d847b387fecfcc812b8460b36cefda68b7e21d Mon Sep 17 00:00:00 2001 From: jhynsoo Date: Mon, 12 Aug 2024 00:02:19 +0900 Subject: [PATCH] =?UTF-8?q?refactor:=20=EB=B6=88=ED=95=84=EC=9A=94?= =?UTF-8?q?=ED=95=9C=20console.log=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ArticleDetailAnswerInput.jsx | 3 --- .../src/components/QuizForm/QuizDetailCard.jsx | 1 - frontend/src/components/QuizForm/QuizsetForm.jsx | 1 - .../src/components/QuizsetDetail/QuizsetDetail.jsx | 1 - frontend/src/hooks/api/useAuth.js | 8 +------- frontend/src/hooks/api/useNoticeEdit.js | 2 +- frontend/src/hooks/api/usePasswordReset.js | 1 - .../src/pages/DefaultHomePage/DefaultHomePage.jsx | 1 - .../src/pages/LectureEditPage/LectureEditPage.jsx | 11 ++++------- .../src/pages/LectureInfoPage/LectureInfoPage.jsx | 4 +--- .../pages/MyInfoChangePage/MyInfoChangePage.jsx | 2 -- .../PasswordChangePage/PasswordChangePage.jsx | 5 +---- .../PasswordResetAuthPage.jsx | 5 +---- .../pages/PasswordResetPage/PasswordResetPage.jsx | 14 ++------------ .../pages/QuestionListPage/QuestionListPage.jsx | 1 - .../pages/QuizsetDetailPage/QuizsetDetailPage.jsx | 3 +-- .../src/pages/QuizsetEditPage/QuizsetEditPage.jsx | 5 ----- .../src/pages/QuizsetListPage/QuizsetListPage.jsx | 3 +-- .../pages/QuizsetWritePage/QuizsetWritePage.jsx | 1 - .../StudentReportDetailPage.jsx | 1 - frontend/src/utils/axios/instance.js | 4 ---- 21 files changed, 13 insertions(+), 64 deletions(-) diff --git a/frontend/src/components/Article/ArticleDetail/ArticleDetailAnswer/ArticleDetailAnswerInput.jsx b/frontend/src/components/Article/ArticleDetail/ArticleDetailAnswer/ArticleDetailAnswerInput.jsx index 6956e29..2645447 100644 --- a/frontend/src/components/Article/ArticleDetail/ArticleDetailAnswer/ArticleDetailAnswerInput.jsx +++ b/frontend/src/components/Article/ArticleDetail/ArticleDetailAnswer/ArticleDetailAnswerInput.jsx @@ -31,7 +31,6 @@ export default function ArticleDetailAnswerInput({ onSubmit, initialAnswer = '', const handleSubmit = async (e) => { e.preventDefault(); - console.log(isEditing); if (isEditing) { await answerEdit(questionId, answer); } else { @@ -40,8 +39,6 @@ export default function ArticleDetailAnswerInput({ onSubmit, initialAnswer = '', onSubmit(answer); }; - console.log(answer); - return (
diff --git a/frontend/src/components/QuizForm/QuizsetForm.jsx b/frontend/src/components/QuizForm/QuizsetForm.jsx index 0ae5d88..555b46b 100644 --- a/frontend/src/components/QuizForm/QuizsetForm.jsx +++ b/frontend/src/components/QuizForm/QuizsetForm.jsx @@ -16,7 +16,6 @@ export default function QuizsetForm({ headerTitle, topic, to, onSubmit, initialV setTitle(initialValue.title || ''); setQuizzes(initialValue.quizzes || []); setQuizId(initialValue.quizzes ? initialValue.quizzes[initialValue.quizzes.length - 1].id + 1 : 0); - console.log(initialValue.quizzes.length); } }, [initialValue]); diff --git a/frontend/src/components/QuizsetDetail/QuizsetDetail.jsx b/frontend/src/components/QuizsetDetail/QuizsetDetail.jsx index b1a3c14..13a5a54 100644 --- a/frontend/src/components/QuizsetDetail/QuizsetDetail.jsx +++ b/frontend/src/components/QuizsetDetail/QuizsetDetail.jsx @@ -4,7 +4,6 @@ import styles from './QuizsetDetail.module.css'; import { QuizDetailCard } from '../QuizForm'; export default function QuizsetDetail({ topic, title, quizzes = [], onDelete, onEdit, tested = false }) { - console.log('topic', topic, 'title', title, 'quizzes', quizzes); return (
diff --git a/frontend/src/hooks/api/useAuth.js b/frontend/src/hooks/api/useAuth.js index 6ed2ac4..0824b58 100644 --- a/frontend/src/hooks/api/useAuth.js +++ b/frontend/src/hooks/api/useAuth.js @@ -40,12 +40,7 @@ export function useAuth() { const logout = () => { return instance .post(`${API_URL}/user/logout`) - .then((response) => { - console.log(response); - }) - .catch((e) => { - console.log(e); - }) + .catch(() => {}) .finally(() => { setUserType(null); setToken(null); @@ -66,7 +61,6 @@ export function useAuth() { newPassword: newPw, newPasswordCheck: newPwCheck, }; - console.log(passwordBody); return instance.put(`${API_URL}/user/updatepassword`, passwordBody); }; diff --git a/frontend/src/hooks/api/useNoticeEdit.js b/frontend/src/hooks/api/useNoticeEdit.js index fc9cbb1..a8c914a 100644 --- a/frontend/src/hooks/api/useNoticeEdit.js +++ b/frontend/src/hooks/api/useNoticeEdit.js @@ -7,7 +7,7 @@ export function useNoticeEdit() { title, content, }; - console.log(newNotice); + return instance.put(`${API_URL}/board/${boardId}`, newNotice); }; diff --git a/frontend/src/hooks/api/usePasswordReset.js b/frontend/src/hooks/api/usePasswordReset.js index d3a1c33..4b5252c 100644 --- a/frontend/src/hooks/api/usePasswordReset.js +++ b/frontend/src/hooks/api/usePasswordReset.js @@ -3,7 +3,6 @@ import { API_URL } from '../../constants'; export function usePasswordReset() { const sendEmail = (email) => { - console.log(email); return instance.post(`${API_URL}/mail/sendcode?email=${email}`); }; diff --git a/frontend/src/pages/DefaultHomePage/DefaultHomePage.jsx b/frontend/src/pages/DefaultHomePage/DefaultHomePage.jsx index bc86d1f..669c2db 100644 --- a/frontend/src/pages/DefaultHomePage/DefaultHomePage.jsx +++ b/frontend/src/pages/DefaultHomePage/DefaultHomePage.jsx @@ -6,7 +6,6 @@ import { useLectures } from '../../hooks/api/useLectures'; export default function StudentHomePage() { const { data: allLectures } = useLectures(); const allClasses = allLectures?.data ?? []; - console.log(allClasses); return ( diff --git a/frontend/src/pages/LectureEditPage/LectureEditPage.jsx b/frontend/src/pages/LectureEditPage/LectureEditPage.jsx index 394af55..2137b43 100644 --- a/frontend/src/pages/LectureEditPage/LectureEditPage.jsx +++ b/frontend/src/pages/LectureEditPage/LectureEditPage.jsx @@ -10,15 +10,12 @@ export default function LecutreEditPage() { const navigate = useNavigate(); const { lectureEdit } = useLectureEdit(); - const handleSubmit = async (lectureObject) => { - const response = await lectureEdit(lectureId, lectureObject) - .then((res) => { - console.log(res); + const handleSubmit = async (lectureObject) => + await lectureEdit(lectureId, lectureObject) + .then(() => { navigate('..'); }) - .catch((err) => console.log(err)); - console.log(response?.data); - }; + .catch(() => {}); return (
diff --git a/frontend/src/pages/LectureInfoPage/LectureInfoPage.jsx b/frontend/src/pages/LectureInfoPage/LectureInfoPage.jsx index 1498a13..2350b8e 100644 --- a/frontend/src/pages/LectureInfoPage/LectureInfoPage.jsx +++ b/frontend/src/pages/LectureInfoPage/LectureInfoPage.jsx @@ -33,9 +33,7 @@ export default function LectureInfoPage() { window.alert('강사가 수강신청 수락시 수업이 시작됩니다.'); navigate('/'); }) - .catch((err) => { - console.log(err); - }); + .catch(() => {}); } }; diff --git a/frontend/src/pages/MyInfoChangePage/MyInfoChangePage.jsx b/frontend/src/pages/MyInfoChangePage/MyInfoChangePage.jsx index e81c225..864c014 100644 --- a/frontend/src/pages/MyInfoChangePage/MyInfoChangePage.jsx +++ b/frontend/src/pages/MyInfoChangePage/MyInfoChangePage.jsx @@ -16,8 +16,6 @@ export default function MyInfoChangePage() { await updateInfo(username, useremail) .then(() => navigate('/')) .catch((err) => { - console.log(err); - console.log(err.response.data); if (err.response.data === '이미 사용 중인 이메일입니다.') { setUsingEmail(true); } diff --git a/frontend/src/pages/PasswordChangePage/PasswordChangePage.jsx b/frontend/src/pages/PasswordChangePage/PasswordChangePage.jsx index 755caef..67a630c 100644 --- a/frontend/src/pages/PasswordChangePage/PasswordChangePage.jsx +++ b/frontend/src/pages/PasswordChangePage/PasswordChangePage.jsx @@ -9,14 +9,11 @@ export default function PasswordChangePage() { const { updatePassword } = useAuth(); const handleSubmit = async (currentPw, newPw, newPwCheck) => { await updatePassword(currentPw, newPw, newPwCheck) - .then((res) => { - console.log(res); + .then(() => { navigate('/'); }) .catch((err) => { - console.log(err.response.data); if (err.response.data === 'Current password is incorrect') { - console.log('현재 비밀번호 에러'); setPwError(true); } }); diff --git a/frontend/src/pages/PasswordResetAuthPage/PasswordResetAuthPage.jsx b/frontend/src/pages/PasswordResetAuthPage/PasswordResetAuthPage.jsx index f4187ff..103f6d4 100644 --- a/frontend/src/pages/PasswordResetAuthPage/PasswordResetAuthPage.jsx +++ b/frontend/src/pages/PasswordResetAuthPage/PasswordResetAuthPage.jsx @@ -21,14 +21,11 @@ export default function PasswordResetPage() { const handleSubmit = (e) => { e.preventDefault(); setAuthError(false); - console.log(authNumRef.current.value, email); verify(authNumRef.current.value, email) - .then((res) => { - console.log(res); + .then(() => { setSentAuthNum(true); }) .catch((err) => { - console.log(err); if (err.message === 'Request failed with status code 404') { setAuthError(true); } diff --git a/frontend/src/pages/PasswordResetPage/PasswordResetPage.jsx b/frontend/src/pages/PasswordResetPage/PasswordResetPage.jsx index 51cd5a5..c969c09 100644 --- a/frontend/src/pages/PasswordResetPage/PasswordResetPage.jsx +++ b/frontend/src/pages/PasswordResetPage/PasswordResetPage.jsx @@ -1,5 +1,5 @@ import { AuthForm, InputBox } from '../../components/AuthForm'; -import { useRef, useState, useEffect } from 'react'; +import { useRef, useState } from 'react'; import styles from './PasswordResetPage.module.css'; import { Link } from 'react-router-dom'; import { usePasswordReset } from '../../hooks/api/usePasswordReset'; @@ -11,24 +11,14 @@ export default function PasswordResetPage() { const { sendEmail } = usePasswordReset(); - useEffect(() => { - if (emailSent) { - console.log('Updated emailSent:', emailSent); - } - }, [emailSent]); - const handleSubmit = async (e) => { e.preventDefault(); setNotFound(false); await sendEmail(emailRef.current.value) .then(() => { - const email = emailRef.current.value; - console.log(email); - setEmailSent(email); - console.log(emailSent); + setEmailSent(emailRef.current.value); }) .catch((err) => { - console.log(err); if (err.message === 'Request failed with status code 404') { setNotFound(true); } diff --git a/frontend/src/pages/QuestionListPage/QuestionListPage.jsx b/frontend/src/pages/QuestionListPage/QuestionListPage.jsx index 583b10b..b81a1d8 100644 --- a/frontend/src/pages/QuestionListPage/QuestionListPage.jsx +++ b/frontend/src/pages/QuestionListPage/QuestionListPage.jsx @@ -10,7 +10,6 @@ export default function QuestionListPage() { const questions = data?.data; const userType = useBoundStore((state) => state.userType); - console.log(questions); return ( { navigate('edit', { state: { initialValue: quizset } }); }; - const handleDelete = async () => { await quizsetDelete(quizsetId); navigate('..'); }; + return ( { e.preventDefault(); @@ -42,10 +41,6 @@ export default function QuizsetEditPage() { } }); - formData.forEach((value, key) => { - console.log(`FormData - Key: ${key}, Value:`, value); - }); - await quizsetEdit(formData); navigate('..'); }; diff --git a/frontend/src/pages/QuizsetListPage/QuizsetListPage.jsx b/frontend/src/pages/QuizsetListPage/QuizsetListPage.jsx index 119cfb9..4659ad1 100644 --- a/frontend/src/pages/QuizsetListPage/QuizsetListPage.jsx +++ b/frontend/src/pages/QuizsetListPage/QuizsetListPage.jsx @@ -8,8 +8,7 @@ export default function QuizsetListPage() { const { lectureId } = useParams(); const { data } = useQuizsets(lectureId); const quizsets = data?.data ?? []; - // const userType = useBoundStore((state) => state.userType); - console.log(quizsets); + return ( { e.preventDefault(); - console.log(quizzes); if (quizzes.length === 0) { window.alert('퀴즈가 없는 퀴즈셋은 생성할 수 없습니다'); return; diff --git a/frontend/src/pages/StudentReportDetailPage/StudentReportDetailPage.jsx b/frontend/src/pages/StudentReportDetailPage/StudentReportDetailPage.jsx index c3a4b3f..1219e62 100644 --- a/frontend/src/pages/StudentReportDetailPage/StudentReportDetailPage.jsx +++ b/frontend/src/pages/StudentReportDetailPage/StudentReportDetailPage.jsx @@ -8,7 +8,6 @@ export default function StudentReportDetailPage() { const { lectureId, reportId } = useParams(); const { data } = useStudentReportDetail(reportId); const report = data.data; - console.log(report); const { allCount, correctCount, quizzes, title } = report; const score = Math.round((100 * correctCount) / allCount); return ( diff --git a/frontend/src/utils/axios/instance.js b/frontend/src/utils/axios/instance.js index 16717f2..5600c2f 100644 --- a/frontend/src/utils/axios/instance.js +++ b/frontend/src/utils/axios/instance.js @@ -33,16 +33,12 @@ instance.interceptors.response.use( .then((response) => { const { accessToken } = response.data; - console.log(accessToken); useBoundStore.setState({ token: accessToken }); error.config.headers.Authorization = `${accessToken}`; return instance(error.config); }) .catch((error) => { useBoundStore.setState({ token: null, userType: null }); - console.log(error); - console.log('---로그아웃----'); - // TODO: redirect to home return Promise.reject(error); }); }