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) => {
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 (
<form
onSubmit={handleSubmit}

View File

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

View File

@ -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]);

View File

@ -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 (
<div className={styles.quizsetDetail}>
<header className={styles.header}>

View File

@ -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);
};

View File

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

View File

@ -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}`);
};

View File

@ -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 (
<MaxWidthLayout>

View File

@ -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 (
<div>

View File

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

View File

@ -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);
}

View File

@ -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);
}
});

View File

@ -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);
}

View File

@ -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);
}

View File

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

View File

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

View File

@ -9,7 +9,6 @@ export default function QuizsetEditPage() {
const location = useLocation();
const initialValue = location.state.initialValue;
const { quizsetEdit } = useQuizsetEdit();
console.log(initialValue);
const handleSubmit = async (e, title, quizzes) => {
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('..');
};

View File

@ -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 (
<ArticleBoard
title="퀴즈 목록"

View File

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

View File

@ -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 (

View File

@ -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);
});
}