refactor: 불필요한 console.log 제거

This commit is contained in:
jhynsoo 2024-08-12 00:02:19 +09:00
parent 3e7a593bbc
commit 31d847b387
21 changed files with 13 additions and 64 deletions

View File

@ -31,7 +31,6 @@ export default function ArticleDetailAnswerInput({ onSubmit, initialAnswer = '',
const handleSubmit = async (e) => { const handleSubmit = async (e) => {
e.preventDefault(); e.preventDefault();
console.log(isEditing);
if (isEditing) { if (isEditing) {
await answerEdit(questionId, answer); await answerEdit(questionId, answer);
} else { } else {
@ -40,8 +39,6 @@ export default function ArticleDetailAnswerInput({ onSubmit, initialAnswer = '',
onSubmit(answer); onSubmit(answer);
}; };
console.log(answer);
return ( return (
<form <form
onSubmit={handleSubmit} onSubmit={handleSubmit}

View File

@ -2,7 +2,6 @@ import styles from './QuizCard.module.css';
import { STATIC_URL } from '../../constants'; import { STATIC_URL } from '../../constants';
export default function QuizDetailCard({ index, question, answer, image, choices, userAnswer = null, correct = true }) { export default function QuizDetailCard({ index, question, answer, image, choices, userAnswer = null, correct = true }) {
console.log(correct);
return ( return (
<div className={`${styles.card} ${!correct && styles.incorrect}`}> <div className={`${styles.card} ${!correct && styles.incorrect}`}>
<div className={styles.header}> <div className={styles.header}>

View File

@ -16,7 +16,6 @@ export default function QuizsetForm({ headerTitle, topic, to, onSubmit, initialV
setTitle(initialValue.title || ''); setTitle(initialValue.title || '');
setQuizzes(initialValue.quizzes || []); setQuizzes(initialValue.quizzes || []);
setQuizId(initialValue.quizzes ? initialValue.quizzes[initialValue.quizzes.length - 1].id + 1 : 0); setQuizId(initialValue.quizzes ? initialValue.quizzes[initialValue.quizzes.length - 1].id + 1 : 0);
console.log(initialValue.quizzes.length);
} }
}, [initialValue]); }, [initialValue]);

View File

@ -4,7 +4,6 @@ import styles from './QuizsetDetail.module.css';
import { QuizDetailCard } from '../QuizForm'; import { QuizDetailCard } from '../QuizForm';
export default function QuizsetDetail({ topic, title, quizzes = [], onDelete, onEdit, tested = false }) { export default function QuizsetDetail({ topic, title, quizzes = [], onDelete, onEdit, tested = false }) {
console.log('topic', topic, 'title', title, 'quizzes', quizzes);
return ( return (
<div className={styles.quizsetDetail}> <div className={styles.quizsetDetail}>
<header className={styles.header}> <header className={styles.header}>

View File

@ -40,12 +40,7 @@ export function useAuth() {
const logout = () => { const logout = () => {
return instance return instance
.post(`${API_URL}/user/logout`) .post(`${API_URL}/user/logout`)
.then((response) => { .catch(() => {})
console.log(response);
})
.catch((e) => {
console.log(e);
})
.finally(() => { .finally(() => {
setUserType(null); setUserType(null);
setToken(null); setToken(null);
@ -66,7 +61,6 @@ export function useAuth() {
newPassword: newPw, newPassword: newPw,
newPasswordCheck: newPwCheck, newPasswordCheck: newPwCheck,
}; };
console.log(passwordBody);
return instance.put(`${API_URL}/user/updatepassword`, passwordBody); return instance.put(`${API_URL}/user/updatepassword`, passwordBody);
}; };

View File

@ -7,7 +7,7 @@ export function useNoticeEdit() {
title, title,
content, content,
}; };
console.log(newNotice);
return instance.put(`${API_URL}/board/${boardId}`, newNotice); return instance.put(`${API_URL}/board/${boardId}`, newNotice);
}; };

View File

@ -3,7 +3,6 @@ import { API_URL } from '../../constants';
export function usePasswordReset() { export function usePasswordReset() {
const sendEmail = (email) => { const sendEmail = (email) => {
console.log(email);
return instance.post(`${API_URL}/mail/sendcode?email=${email}`); return instance.post(`${API_URL}/mail/sendcode?email=${email}`);
}; };

View File

@ -6,7 +6,6 @@ import { useLectures } from '../../hooks/api/useLectures';
export default function StudentHomePage() { export default function StudentHomePage() {
const { data: allLectures } = useLectures(); const { data: allLectures } = useLectures();
const allClasses = allLectures?.data ?? []; const allClasses = allLectures?.data ?? [];
console.log(allClasses);
return ( return (
<MaxWidthLayout> <MaxWidthLayout>

View File

@ -10,15 +10,12 @@ export default function LecutreEditPage() {
const navigate = useNavigate(); const navigate = useNavigate();
const { lectureEdit } = useLectureEdit(); const { lectureEdit } = useLectureEdit();
const handleSubmit = async (lectureObject) => { const handleSubmit = async (lectureObject) =>
const response = await lectureEdit(lectureId, lectureObject) await lectureEdit(lectureId, lectureObject)
.then((res) => { .then(() => {
console.log(res);
navigate('..'); navigate('..');
}) })
.catch((err) => console.log(err)); .catch(() => {});
console.log(response?.data);
};
return ( return (
<div> <div>

View File

@ -33,9 +33,7 @@ export default function LectureInfoPage() {
window.alert('강사가 수강신청 수락시 수업이 시작됩니다.'); window.alert('강사가 수강신청 수락시 수업이 시작됩니다.');
navigate('/'); navigate('/');
}) })
.catch((err) => { .catch(() => {});
console.log(err);
});
} }
}; };

View File

@ -16,8 +16,6 @@ export default function MyInfoChangePage() {
await updateInfo(username, useremail) await updateInfo(username, useremail)
.then(() => navigate('/')) .then(() => navigate('/'))
.catch((err) => { .catch((err) => {
console.log(err);
console.log(err.response.data);
if (err.response.data === '이미 사용 중인 이메일입니다.') { if (err.response.data === '이미 사용 중인 이메일입니다.') {
setUsingEmail(true); setUsingEmail(true);
} }

View File

@ -9,14 +9,11 @@ export default function PasswordChangePage() {
const { updatePassword } = useAuth(); const { updatePassword } = useAuth();
const handleSubmit = async (currentPw, newPw, newPwCheck) => { const handleSubmit = async (currentPw, newPw, newPwCheck) => {
await updatePassword(currentPw, newPw, newPwCheck) await updatePassword(currentPw, newPw, newPwCheck)
.then((res) => { .then(() => {
console.log(res);
navigate('/'); navigate('/');
}) })
.catch((err) => { .catch((err) => {
console.log(err.response.data);
if (err.response.data === 'Current password is incorrect') { if (err.response.data === 'Current password is incorrect') {
console.log('현재 비밀번호 에러');
setPwError(true); setPwError(true);
} }
}); });

View File

@ -21,14 +21,11 @@ export default function PasswordResetPage() {
const handleSubmit = (e) => { const handleSubmit = (e) => {
e.preventDefault(); e.preventDefault();
setAuthError(false); setAuthError(false);
console.log(authNumRef.current.value, email);
verify(authNumRef.current.value, email) verify(authNumRef.current.value, email)
.then((res) => { .then(() => {
console.log(res);
setSentAuthNum(true); setSentAuthNum(true);
}) })
.catch((err) => { .catch((err) => {
console.log(err);
if (err.message === 'Request failed with status code 404') { if (err.message === 'Request failed with status code 404') {
setAuthError(true); setAuthError(true);
} }

View File

@ -1,5 +1,5 @@
import { AuthForm, InputBox } from '../../components/AuthForm'; import { AuthForm, InputBox } from '../../components/AuthForm';
import { useRef, useState, useEffect } from 'react'; import { useRef, useState } from 'react';
import styles from './PasswordResetPage.module.css'; import styles from './PasswordResetPage.module.css';
import { Link } from 'react-router-dom'; import { Link } from 'react-router-dom';
import { usePasswordReset } from '../../hooks/api/usePasswordReset'; import { usePasswordReset } from '../../hooks/api/usePasswordReset';
@ -11,24 +11,14 @@ export default function PasswordResetPage() {
const { sendEmail } = usePasswordReset(); const { sendEmail } = usePasswordReset();
useEffect(() => {
if (emailSent) {
console.log('Updated emailSent:', emailSent);
}
}, [emailSent]);
const handleSubmit = async (e) => { const handleSubmit = async (e) => {
e.preventDefault(); e.preventDefault();
setNotFound(false); setNotFound(false);
await sendEmail(emailRef.current.value) await sendEmail(emailRef.current.value)
.then(() => { .then(() => {
const email = emailRef.current.value; setEmailSent(emailRef.current.value);
console.log(email);
setEmailSent(email);
console.log(emailSent);
}) })
.catch((err) => { .catch((err) => {
console.log(err);
if (err.message === 'Request failed with status code 404') { if (err.message === 'Request failed with status code 404') {
setNotFound(true); setNotFound(true);
} }

View File

@ -10,7 +10,6 @@ export default function QuestionListPage() {
const questions = data?.data; const questions = data?.data;
const userType = useBoundStore((state) => state.userType); const userType = useBoundStore((state) => state.userType);
console.log(questions);
return ( return (
<ArticleBoard <ArticleBoard
title="Q&A" title="Q&A"

View File

@ -10,15 +10,14 @@ export default function QuizsetDetailPage() {
const { data } = useTeacherQuizsetDetail(quizsetId); const { data } = useTeacherQuizsetDetail(quizsetId);
const quizset = data.data; const quizset = data.data;
const tested = quizset.tested; const tested = quizset.tested;
console.log(tested);
const handleEdit = () => { const handleEdit = () => {
navigate('edit', { state: { initialValue: quizset } }); navigate('edit', { state: { initialValue: quizset } });
}; };
const handleDelete = async () => { const handleDelete = async () => {
await quizsetDelete(quizsetId); await quizsetDelete(quizsetId);
navigate('..'); navigate('..');
}; };
return ( return (
<QuizsetDetail <QuizsetDetail
topic={'퀴즈 목록'} topic={'퀴즈 목록'}

View File

@ -9,7 +9,6 @@ export default function QuizsetEditPage() {
const location = useLocation(); const location = useLocation();
const initialValue = location.state.initialValue; const initialValue = location.state.initialValue;
const { quizsetEdit } = useQuizsetEdit(); const { quizsetEdit } = useQuizsetEdit();
console.log(initialValue);
const handleSubmit = async (e, title, quizzes) => { const handleSubmit = async (e, title, quizzes) => {
e.preventDefault(); e.preventDefault();
@ -42,10 +41,6 @@ export default function QuizsetEditPage() {
} }
}); });
formData.forEach((value, key) => {
console.log(`FormData - Key: ${key}, Value:`, value);
});
await quizsetEdit(formData); await quizsetEdit(formData);
navigate('..'); navigate('..');
}; };

View File

@ -8,8 +8,7 @@ export default function QuizsetListPage() {
const { lectureId } = useParams(); const { lectureId } = useParams();
const { data } = useQuizsets(lectureId); const { data } = useQuizsets(lectureId);
const quizsets = data?.data ?? []; const quizsets = data?.data ?? [];
// const userType = useBoundStore((state) => state.userType);
console.log(quizsets);
return ( return (
<ArticleBoard <ArticleBoard
title="퀴즈 목록" title="퀴즈 목록"

View File

@ -8,7 +8,6 @@ export default function QuizsetWritePage() {
const handleSubmit = async (e, title, quizzes) => { const handleSubmit = async (e, title, quizzes) => {
e.preventDefault(); e.preventDefault();
console.log(quizzes);
if (quizzes.length === 0) { if (quizzes.length === 0) {
window.alert('퀴즈가 없는 퀴즈셋은 생성할 수 없습니다'); window.alert('퀴즈가 없는 퀴즈셋은 생성할 수 없습니다');
return; return;

View File

@ -8,7 +8,6 @@ export default function StudentReportDetailPage() {
const { lectureId, reportId } = useParams(); const { lectureId, reportId } = useParams();
const { data } = useStudentReportDetail(reportId); const { data } = useStudentReportDetail(reportId);
const report = data.data; const report = data.data;
console.log(report);
const { allCount, correctCount, quizzes, title } = report; const { allCount, correctCount, quizzes, title } = report;
const score = Math.round((100 * correctCount) / allCount); const score = Math.round((100 * correctCount) / allCount);
return ( return (

View File

@ -33,16 +33,12 @@ instance.interceptors.response.use(
.then((response) => { .then((response) => {
const { accessToken } = response.data; const { accessToken } = response.data;
console.log(accessToken);
useBoundStore.setState({ token: accessToken }); useBoundStore.setState({ token: accessToken });
error.config.headers.Authorization = `${accessToken}`; error.config.headers.Authorization = `${accessToken}`;
return instance(error.config); return instance(error.config);
}) })
.catch((error) => { .catch((error) => {
useBoundStore.setState({ token: null, userType: null }); useBoundStore.setState({ token: null, userType: null });
console.log(error);
console.log('---로그아웃----');
// TODO: redirect to home
return Promise.reject(error); return Promise.reject(error);
}); });
} }