From 2fb2c6ad3f1ff25e448b93ffcc3616138078b399 Mon Sep 17 00:00:00 2001 From: heeyongKim <166043860+heeeeyong@users.noreply.github.com> Date: Wed, 26 Nov 2025 05:18:26 +0900 Subject: [PATCH] =?UTF-8?q?chore:=20=EB=B6=88=ED=95=84=EC=9A=94=ED=95=9C?= =?UTF-8?q?=20=EC=A3=BC=EC=84=9D=20=EB=B0=8F=20console.log=20=EB=A9=94?= =?UTF-8?q?=EC=84=9C=EB=93=9C=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/books/getSavedBooksInMy.ts | 12 +-------- src/api/feeds/getFeedDetail.ts | 11 -------- src/api/feeds/getMyFeed.ts | 22 +--------------- src/api/feeds/getMyProfile.ts | 10 -------- src/api/feeds/getOtherFeed.ts | 10 -------- src/api/feeds/getSavedFeedsInMy.ts | 17 ------------ src/api/feeds/getTotalFeed.ts | 23 +---------------- src/api/feeds/postSave.ts | 30 +++------------------- src/api/index.ts | 9 ------- src/api/users/getOtherProfile.ts | 9 ------- src/components/Mypage/EditProfile.tsx | 0 src/components/common/AsideDecoration.tsx | 1 - src/components/common/Layout.tsx | 1 - src/components/common/Modal/MoreMenu.tsx | 6 ----- src/components/common/Modal/ReplyModal.tsx | 5 ---- src/components/common/Post/PostFooter.tsx | 5 +--- src/components/common/Post/Reply.tsx | 5 ---- src/components/common/Post/SubReply.tsx | 22 ---------------- src/components/common/ScrollToTop.tsx | 2 +- src/components/common/TokenStatus.tsx | 1 - src/components/feed/BookInfoCard.tsx | 2 -- src/components/feed/FeedDetailPost.tsx | 4 --- src/components/feed/FeedDetailPostBody.tsx | 10 ++++---- src/components/feed/FeedPost.tsx | 4 --- src/components/feed/FollowList.tsx | 10 +++----- src/components/feed/MyFeed.tsx | 8 ++---- src/components/feed/OtherFeed.tsx | 8 ++---- src/components/feed/Profile.tsx | 15 +---------- src/components/feed/TabBar.tsx | 2 -- src/components/feed/TotalBar.tsx | 2 -- src/components/feed/TotalFeed.tsx | 2 +- src/components/feed/UserProfileItem.tsx | 5 ---- src/hooks/useReplyActions.ts | 5 ++-- src/hooks/useSocialLoginToken.ts | 20 ++------------- src/hooks/useUserSearch.ts | 1 - src/pages/Guide.tsx | 19 +++----------- src/pages/feed/Feed.tsx | 22 +--------------- src/pages/feed/FeedDetailPage.tsx | 8 ------ src/pages/feed/FollowerListPage.tsx | 22 ---------------- src/pages/feed/MyFeedPage.tsx | 6 +---- src/pages/feed/OtherFeedPage.tsx | 4 +-- src/pages/feed/UserSearch.tsx | 30 +++++----------------- src/pages/feed/UserSearchResult.tsx | 5 +--- src/pages/index.tsx | 1 - src/pages/login/Login.tsx | 13 ---------- src/pages/mypage/AlertPage.tsx | 4 --- src/pages/mypage/EditPage.tsx | 21 +-------------- src/pages/mypage/Mypage.tsx | 4 +-- src/pages/mypage/SavePage.tsx | 26 +------------------ src/pages/notice/Notice.tsx | 24 +++-------------- src/pages/signup/SignupDone.tsx | 2 -- src/pages/signup/SignupGenre.tsx | 9 ------- src/pages/signup/SignupNickname.tsx | 12 --------- vite.config.ts | 1 - 54 files changed, 45 insertions(+), 487 deletions(-) delete mode 100644 src/components/Mypage/EditProfile.tsx diff --git a/src/api/books/getSavedBooksInMy.ts b/src/api/books/getSavedBooksInMy.ts index 1f60f62b..0eb04dab 100644 --- a/src/api/books/getSavedBooksInMy.ts +++ b/src/api/books/getSavedBooksInMy.ts @@ -1,6 +1,6 @@ import { apiClient } from '../index'; -// 개인적으로 저장한 책 정보 타입 +// 저장한 책 정보 타입 export interface SavedBookInMy { bookId: number; bookTitle: string; @@ -11,14 +11,12 @@ export interface SavedBookInMy { isSaved: boolean; } -// API 응답 데이터 타입 export interface SavedBooksInMyData { bookList: SavedBookInMy[]; nextCursor: string; isLast: boolean; } -// API 응답 타입 export interface SavedBooksInMyResponse { isSuccess: boolean; code: number; @@ -26,7 +24,6 @@ export interface SavedBooksInMyResponse { data: SavedBooksInMyData; } -// 개인적으로 저장한 책 목록 조회 API 함수 (무한스크롤) export const getSavedBooksInMy = async (cursor: string | null = null) => { try { const params: { cursor?: string | null } = {}; @@ -43,10 +40,3 @@ export const getSavedBooksInMy = async (cursor: string | null = null) => { throw error; } }; - -/* -// 사용 예시 -const savedBooksInMy = await getSavedBooksInMy(); -console.log(savedBooksInMy.data.bookList); // 개인 저장 책 목록 -console.log(savedBooksInMy.data.bookList[0].bookTitle); // 첫 번째 책 제목 -*/ diff --git a/src/api/feeds/getFeedDetail.ts b/src/api/feeds/getFeedDetail.ts index f634e453..1d291f8b 100644 --- a/src/api/feeds/getFeedDetail.ts +++ b/src/api/feeds/getFeedDetail.ts @@ -1,6 +1,5 @@ import { apiClient } from '../index'; -// 피드 상세 정보 타입 (PostData + 추가 필드들) export interface FeedDetailData { feedId: number; creatorId: number; @@ -24,7 +23,6 @@ export interface FeedDetailData { isWriter: boolean; } -// API 응답 타입 export interface FeedDetailResponse { isSuccess: boolean; code: number; @@ -32,16 +30,7 @@ export interface FeedDetailResponse { data: FeedDetailData; } -// 피드 상세 조회 API 함수 export const getFeedDetail = async (feedId: number) => { const response = await apiClient.get(`/feeds/${feedId}`); return response.data; }; - -/* -// 피드 상세 정보 조회 -const feedDetail = await getFeedDetail(123); -console.log(feedDetail.data.feedId); // 123 -console.log(feedDetail.data.tagList); // ["태그1", "태그2"] -console.log(feedDetail.data.isPublic); // true or false -*/ diff --git a/src/api/feeds/getMyFeed.ts b/src/api/feeds/getMyFeed.ts index 88954cc4..566c9035 100644 --- a/src/api/feeds/getMyFeed.ts +++ b/src/api/feeds/getMyFeed.ts @@ -1,14 +1,12 @@ import { apiClient } from '../index'; import type { PostData } from '@/types/post'; -// API 응답 데이터 타입 export interface MyFeedData { feedList: PostData[]; nextCursor: string; isLast: boolean; } -// API 응답 타입 export interface MyFeedResponse { isSuccess: boolean; code: number; @@ -16,16 +14,13 @@ export interface MyFeedResponse { data: MyFeedData; } -// 요청 파라미터 타입 export interface GetMyFeedParams { - cursor?: string; // 첫 페이지는 null 또는 없음, 다음 페이지부터는 nextCursor 값 사용 + cursor?: string; } -// 내 피드 조회 API 함수 export const getMyFeeds = async (params?: GetMyFeedParams) => { const queryParams = new URLSearchParams(); - // cursor가 있을 때만 쿼리 파라미터에 추가 if (params?.cursor) { queryParams.append('cursor', params.cursor); } @@ -35,18 +30,3 @@ export const getMyFeeds = async (params?: GetMyFeedParams) => { const response = await apiClient.get(url); return response.data; }; - -/* -// 첫 페이지 조회 -const firstPage = await getMyFeeds(); - -// 다음 페이지 조회 (nextCursor 사용) -const nextPage = await getMyFeeds({ - cursor: firstPage.data.nextCursor -}); - -// 마지막 페이지인지 확인 -if (firstPage.data.isLast) { - console.log('더 이상 불러올 데이터가 없습니다.'); -} -*/ diff --git a/src/api/feeds/getMyProfile.ts b/src/api/feeds/getMyProfile.ts index 98b6233c..2a7d4484 100644 --- a/src/api/feeds/getMyProfile.ts +++ b/src/api/feeds/getMyProfile.ts @@ -1,7 +1,5 @@ import { apiClient } from '../index'; import type { MyProfileData } from '@/types/profile'; - -// API 응답 타입 export interface MyProfileResponse { isSuccess: boolean; code: number; @@ -9,15 +7,7 @@ export interface MyProfileResponse { data: MyProfileData; } -// 내 프로필 조회 API 함수 export const getMyProfile = async () => { const response = await apiClient.get('/feeds/mine/info'); return response.data; }; - -/* -// 내 프로필 정보 조회 -const myProfile = await getMyProfile(); -console.log(myProfile.data.nickname); // 닉네임 -console.log(myProfile.data.followerCount); // 팔로워 수 -*/ diff --git a/src/api/feeds/getOtherFeed.ts b/src/api/feeds/getOtherFeed.ts index fc7c3fc3..fb2ea031 100644 --- a/src/api/feeds/getOtherFeed.ts +++ b/src/api/feeds/getOtherFeed.ts @@ -1,6 +1,5 @@ import { apiClient } from '../index'; -// 다른 사용자의 피드 아이템 타입 export interface OtherFeedItem { feedId: number; postDate: string; @@ -14,12 +13,10 @@ export interface OtherFeedItem { isSaved: boolean; } -// API 응답 데이터 타입 export interface OtherFeedData { feedList: OtherFeedItem[]; } -// API 응답 타입 export interface OtherFeedResponse { isSuccess: boolean; code: number; @@ -27,14 +24,7 @@ export interface OtherFeedResponse { data: OtherFeedData; } -// 다른 사용자 피드 조회 API 함수 export const getOtherFeed = async (userId: number) => { const response = await apiClient.get(`/feeds/users/${userId}`); return response.data; }; - -/* -다른 사용자의 피드 리스트 조회 -const otherUserFeed = await getOtherFeed(123); -console.log(otherUserFeed.data.feedList); // OtherFeedItem[] -*/ diff --git a/src/api/feeds/getSavedFeedsInMy.ts b/src/api/feeds/getSavedFeedsInMy.ts index 0cacbc6f..55349b15 100644 --- a/src/api/feeds/getSavedFeedsInMy.ts +++ b/src/api/feeds/getSavedFeedsInMy.ts @@ -1,6 +1,5 @@ import { apiClient } from '../index'; -// 개인적으로 저장한 피드 정보 타입 export interface SavedFeedInMy { feedId: number; creatorId: number; @@ -21,14 +20,12 @@ export interface SavedFeedInMy { isWriter: boolean; } -// API 응답 데이터 타입 (무한스크롤 지원) export interface SavedFeedsInMyData { feedList: SavedFeedInMy[]; nextCursor: string; isLast: boolean; } -// API 응답 타입 export interface SavedFeedsInMyResponse { isSuccess: boolean; code: number; @@ -36,7 +33,6 @@ export interface SavedFeedsInMyResponse { data: SavedFeedsInMyData; } -// 개인적으로 저장한 피드 목록 조회 API 함수 (무한스크롤) export const getSavedFeedsInMy = async (cursor: string | null = null) => { try { const params: { cursor?: string | null } = {}; @@ -53,16 +49,3 @@ export const getSavedFeedsInMy = async (cursor: string | null = null) => { throw error; } }; - -/* -// 사용 예시 (무한스크롤) -const savedFeedsInMy = await getSavedFeedsInMy(); -console.log(savedFeedsInMy.data.feedList); // 저장된 피드 목록 -console.log(savedFeedsInMy.data.nextCursor); // 다음 페이지 커서 -console.log(savedFeedsInMy.data.isLast); // 마지막 페이지 여부 - -// 다음 페이지 로드 -if (!savedFeedsInMy.data.isLast) { - const nextPage = await getSavedFeedsInMy(savedFeedsInMy.data.nextCursor); -} -*/ diff --git a/src/api/feeds/getTotalFeed.ts b/src/api/feeds/getTotalFeed.ts index 9fb77e39..2bab98f7 100644 --- a/src/api/feeds/getTotalFeed.ts +++ b/src/api/feeds/getTotalFeed.ts @@ -1,14 +1,12 @@ import { apiClient } from '../index'; import type { PostData } from '@/types/post'; -// API 응답 데이터 타입 export interface TotalFeedData { feedList: PostData[]; nextCursor: string; isLast: boolean; } -// API 응답 타입 export interface TotalFeedResponse { isSuccess: boolean; code: number; @@ -16,15 +14,13 @@ export interface TotalFeedResponse { data: TotalFeedData; } -// 요청 파라미터 타입 export interface GetTotalFeedParams { - cursor?: string; // 첫 페이지는 null 또는 없음, 다음 페이지부터는 nextCursor 값 사용 + cursor?: string; } export const getTotalFeeds = async (params?: GetTotalFeedParams) => { const queryParams = new URLSearchParams(); - // cursor가 있을 때만 쿼리 파라미터에 추가 if (params?.cursor) { queryParams.append('cursor', params.cursor); } @@ -34,20 +30,3 @@ export const getTotalFeeds = async (params?: GetTotalFeedParams) => { const response = await apiClient.get(url); return response.data; }; - -/* -사용 방법: - -// 첫 페이지 조회 -const firstPage = await getTotalFeeds(); - -// 다음 페이지 조회 (nextCursor 사용) -const nextPage = await getTotalFeeds({ - cursor: firstPage.data.nextCursor -}); - -// 마지막 페이지인지 확인 -if (firstPage.data.isLast) { - console.log('더 이상 불러올 데이터가 없습니다.'); -} -*/ diff --git a/src/api/feeds/postSave.ts b/src/api/feeds/postSave.ts index c7cf7ae9..14db879b 100644 --- a/src/api/feeds/postSave.ts +++ b/src/api/feeds/postSave.ts @@ -1,50 +1,26 @@ import { apiClient } from '../index'; -// 요청 바디 타입 export interface SaveFeedRequest { - type: boolean; // true: 저장, false: 저장 취소 + type: boolean; } -// 응답 데이터 타입 export interface SaveFeedData { feedId: number; isSaved: boolean; } -// API 응답 타입 export interface SaveFeedResponse { isSuccess: boolean; code: number; message: string; - data?: SaveFeedData; // 성공 시에만 존재 + data?: SaveFeedData; } -// 피드 저장/저장 취소 API 함수 export const postSaveFeed = async (feedId: number, isSaved: boolean) => { const requestBody: SaveFeedRequest = { - type: isSaved, // 현재 저장 상태로 변경 + type: isSaved, }; const response = await apiClient.post(`/feeds/${feedId}/saved`, requestBody); return response.data; }; - -/* -사용 방법: - -// 피드 저장 -const saveResult = await postSaveFeed(123, true); -if (saveResult.isSuccess) { - console.log('저장 성공:', saveResult.data?.isSaved); -} else { - console.log('저장 실패:', saveResult.message); -} - -// 피드 저장 취소 -const unsaveResult = await postSaveFeed(123, false); -if (unsaveResult.isSuccess) { - console.log('저장 취소 성공:', unsaveResult.data?.isSaved); -} else { - console.log('저장 취소 실패:', unsaveResult.message); -} -*/ diff --git a/src/api/index.ts b/src/api/index.ts index f4efc05e..cb680d4f 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -1,9 +1,7 @@ import axios, { type AxiosResponse, type AxiosError } from 'axios'; -// API 기본 URL const API_BASE_URL = import.meta.env.VITE_API_BASE_URL; -// Axios 인스턴스 생성 export const apiClient = axios.create({ baseURL: API_BASE_URL, timeout: 10000, @@ -11,29 +9,23 @@ export const apiClient = axios.create({ 'Content-Type': 'application/json', }, }); -// Request 인터셉터: 토큰 부재 시 비공개 API 요청을 선제 차단(리다이렉트 + 요청 취소) apiClient.interceptors.request.use( config => { const authToken = localStorage.getItem('authToken'); const preAuthToken = localStorage.getItem('preAuthToken'); - // 공개 API(완전 공개) const publicPaths = ['/auth/token']; - // 회원가입 진행 중 필요한 경로(임시 토큰 허용) const signupPaths = ['/users/nickname', '/users/signup']; const isPublic = publicPaths.some(path => config.url?.startsWith(path)); const isSignupPath = signupPaths.some(path => config.url?.startsWith(path)); if (!authToken && !isPublic && !(preAuthToken && isSignupPath)) { - console.log('❌ 토큰 없음: 요청을 취소하고 홈으로 이동합니다.'); window.location.href = '/'; - // 요청 자체를 취소하여 불필요한 네트워크 왕복 방지 return Promise.reject(new Error('Request cancelled: missing auth token')); } if (authToken) { config.headers.Authorization = `Bearer ${authToken}`; } else if (preAuthToken && isSignupPath) { - // 회원가입 경로에서는 임시 토큰을 사용 config.headers.Authorization = `Bearer ${preAuthToken}`; } @@ -42,7 +34,6 @@ apiClient.interceptors.request.use( error => Promise.reject(error), ); -// Response 인터셉터: 401 에러 시 로그인 페이지로 리다이렉트 apiClient.interceptors.response.use( (response: AxiosResponse) => response, (error: AxiosError) => { diff --git a/src/api/users/getOtherProfile.ts b/src/api/users/getOtherProfile.ts index 1a7ddf30..ecb09a3c 100644 --- a/src/api/users/getOtherProfile.ts +++ b/src/api/users/getOtherProfile.ts @@ -1,6 +1,5 @@ import { apiClient } from '../index'; import type { OtherProfileData } from '@/types/profile'; -// API 응답 타입 export interface OtherProfileResponse { isSuccess: boolean; code: number; @@ -8,15 +7,7 @@ export interface OtherProfileResponse { data: OtherProfileData; } -// 다른 사용자 프로필 조회 API 함수 export const getOtherProfile = async (userId: number) => { const response = await apiClient.get(`/feeds/users/${userId}/info`); return response.data; }; - -/* -// 다른 사용자의 프로필 정보 조회 -const otherProfile = await getOtherProfile(123); -console.log(otherProfile.data.nickname); // 닉네임 -console.log(otherProfile.data.followerCount); // 팔로워 수 -*/ diff --git a/src/components/Mypage/EditProfile.tsx b/src/components/Mypage/EditProfile.tsx deleted file mode 100644 index e69de29b..00000000 diff --git a/src/components/common/AsideDecoration.tsx b/src/components/common/AsideDecoration.tsx index 77e534e9..391e52ba 100644 --- a/src/components/common/AsideDecoration.tsx +++ b/src/components/common/AsideDecoration.tsx @@ -13,7 +13,6 @@ export default AsideDecoration; const Wrapper = styled.div` position: fixed; - /* 뷰포트 중앙 기준으로 왼쪽 방향으로 200px 떨어뜨림 */ left: 50%; transform: translateX(-650px); bottom: 0; diff --git a/src/components/common/Layout.tsx b/src/components/common/Layout.tsx index 41bfbd18..b29af31e 100644 --- a/src/components/common/Layout.tsx +++ b/src/components/common/Layout.tsx @@ -8,7 +8,6 @@ const Layout = () => { const location = useLocation(); useEffect(() => { - // 라우트별 페이지 타이틀 설정 (첫 세그먼트 기준으로 그룹핑) const path = location.pathname; const titleRules: Array<[RegExp, string]> = [ [/^\/$/, 'THIP - 로그인'], diff --git a/src/components/common/Modal/MoreMenu.tsx b/src/components/common/Modal/MoreMenu.tsx index d678a935..de84bf65 100644 --- a/src/components/common/Modal/MoreMenu.tsx +++ b/src/components/common/Modal/MoreMenu.tsx @@ -6,7 +6,6 @@ const MoreMenu = ({ onEdit, onDelete, onClose, onReport, isWriter, type }: MoreM return ( onClose?.()}> {type === 'post' ? ( - // post 타입: 기존 로직 유지 <> {isWriter ? ( <> @@ -28,7 +27,6 @@ const MoreMenu = ({ onEdit, onDelete, onClose, onReport, isWriter, type }: MoreM )} ) : ( - // reply 타입: isWriter에 따라 삭제하기 또는 신고하기만 표시 <> {isWriter ? ( e.stopPropagation()}> @@ -56,15 +54,12 @@ const Overlay = styled.div` justify-content: center; align-items: flex-end; - /* ⬇︎ 핵심: 실제 보이는 높이로 맞추기 (dvh 폴백 포함) */ height: 100vh; @supports (height: 100dvh) { height: 100dvh; } - /* JS 폴백 변수 */ height: var(--vvh, 100dvh); - /* ⬇︎ 하단 안전영역만큼 띄워서 탭바/홈바를 피함 */ padding-bottom: env(safe-area-inset-bottom, 0); width: 100vw; @@ -87,7 +82,6 @@ const ReportContainer = styled.div` background-color: ${colors.darkgrey.main}; `; -// 3개 버튼을 위한 컨테이너 (핀하기 포함) const RecordContainer = styled.div` position: relative; display: flex; diff --git a/src/components/common/Modal/ReplyModal.tsx b/src/components/common/Modal/ReplyModal.tsx index 2adb16be..cbc56541 100644 --- a/src/components/common/Modal/ReplyModal.tsx +++ b/src/components/common/Modal/ReplyModal.tsx @@ -59,10 +59,6 @@ const ReplyModal = ({ isOpen, userId, commentId, position, onClose }: ReplyModal }); }; - // const handleReport = () => { - // onClose(); - // }; - if (!isOpen) return null; return ( @@ -75,7 +71,6 @@ const ReplyModal = ({ isOpen, userId, commentId, position, onClose }: ReplyModal }} > - {/* 내 댓글이면 삭제하기, 다른 사람 댓글이면 신고하기 */} {isMyReply ? (
신고하기
diff --git a/src/components/common/Post/PostFooter.tsx b/src/components/common/Post/PostFooter.tsx index 418d9671..acf543e1 100644 --- a/src/components/common/Post/PostFooter.tsx +++ b/src/components/common/Post/PostFooter.tsx @@ -75,7 +75,6 @@ const PostFooter = ({ const response = await postFeedLike(feedId, !liked); if (response.isSuccess) { - // 성공 시 상태 업데이트 setLiked(response.data.isLiked); setLikeCount(prev => (response.data.isLiked ? prev + 1 : prev - 1)); console.log('좋아요 상태 변경 성공:', response.data.isLiked); @@ -93,11 +92,9 @@ const PostFooter = ({ if (response.isSuccess) { const newSaveState = response.data?.isSaved ?? !saved; - // 성공 시 상태 업데이트 setSaved(newSaveState); console.log('저장 상태 변경 성공:', newSaveState); - - // 부모 컴포넌트에 알림 + if (onSaveToggle) { onSaveToggle(feedId, newSaveState); } diff --git a/src/components/common/Post/Reply.tsx b/src/components/common/Post/Reply.tsx index d2dc3998..36c63eb5 100644 --- a/src/components/common/Post/Reply.tsx +++ b/src/components/common/Post/Reply.tsx @@ -59,7 +59,6 @@ const Reply = ({ }; const handleReplyClick = () => { - // 답글 작성 시에는 현재 댓글 작성자의 이름을 사용 startReply(creatorNickname, commentId); }; @@ -69,7 +68,6 @@ const Reply = ({ closePopup(); if (response.isSuccess) { - // 약간의 지연 후 스낵바 오픈 → 진입 애니메이션이 확실히 보이도록 setTimeout(() => { openSnackbar({ message: '댓글이 삭제되었습니다.', @@ -104,7 +102,6 @@ const Reply = ({ const handleMoreClick = () => { if (isWriter) { - // 작성자인 경우: 삭제하기만 표시 openMoreMenu({ onDelete: handleDelete, type: 'reply', @@ -112,7 +109,6 @@ const Reply = ({ onClose: closePopup, }); } else { - // 작성자가 아닌 경우: 신고하기만 표시 openMoreMenu({ onReport: () => { closePopup(); @@ -129,7 +125,6 @@ const Reply = ({ } }; - // 삭제된 댓글인 경우 처리 if (isDeleted) { return ( diff --git a/src/components/common/Post/SubReply.tsx b/src/components/common/Post/SubReply.tsx index 11c35c5d..3b6c6856 100644 --- a/src/components/common/Post/SubReply.tsx +++ b/src/components/common/Post/SubReply.tsx @@ -49,7 +49,6 @@ const SubReply = ({ if (response.isSuccess) { console.log('좋아요 상태 변경 성공:', response); - // 서버 응답으로 상태 업데이트 setLiked(response.data.isLiked); setCurrentLikeCount(prev => (response.data.isLiked ? prev + 1 : prev - 1)); } else { @@ -65,27 +64,9 @@ const SubReply = ({ } }; - // 이전 더보기 모달 - // const handleMoreClick = () => { - // if (containerRef.current) { - // const rect = containerRef.current.getBoundingClientRect(); - // openReplyModal({ - // isOpen: true, - // userId: creatorId, - // commentId: commentId, - // position: { - // x: rect.right, - // y: rect.bottom, - // }, - // onClose: closePopup, - // }); - // } - // }; - const handleDelete = async () => { try { const response = await deleteComment(commentId); - // 먼저 현재 모달/메뉴를 닫아 UI를 정리 closePopup(); if (response.isSuccess) { @@ -121,7 +102,6 @@ const SubReply = ({ const handleMoreClick = () => { if (isWriter) { - // 작성자인 경우: 삭제하기만 표시 openMoreMenu({ onDelete: handleDelete, type: 'reply', @@ -129,7 +109,6 @@ const SubReply = ({ onClose: closePopup, }); } else { - // 작성자가 아닌 경우: 신고하기만 표시 openMoreMenu({ onReport: () => { closePopup(); @@ -146,7 +125,6 @@ const SubReply = ({ } }; - // 삭제된 댓글인 경우 처리 if (isDeleted) { return ( diff --git a/src/components/common/ScrollToTop.tsx b/src/components/common/ScrollToTop.tsx index 642d49c4..10cd3fba 100644 --- a/src/components/common/ScrollToTop.tsx +++ b/src/components/common/ScrollToTop.tsx @@ -8,7 +8,7 @@ const ScrollToTop = () => { window.scrollTo(0, 0); }, [location.pathname]); - return null; // 렌더링하지 않는 컴포넌트 + return null; }; export default ScrollToTop; diff --git a/src/components/common/TokenStatus.tsx b/src/components/common/TokenStatus.tsx index b852dfe3..1693d1df 100644 --- a/src/components/common/TokenStatus.tsx +++ b/src/components/common/TokenStatus.tsx @@ -16,7 +16,6 @@ const TokenStatus = () => { }; checkToken(); - // 5초마다 상태 확인 const interval = setInterval(checkToken, 5000); return () => clearInterval(interval); diff --git a/src/components/feed/BookInfoCard.tsx b/src/components/feed/BookInfoCard.tsx index 36e0d232..ad0fdf12 100644 --- a/src/components/feed/BookInfoCard.tsx +++ b/src/components/feed/BookInfoCard.tsx @@ -32,8 +32,6 @@ const BookContainer = styled.div` display: flex; height: 44px; padding: 8px 4px 8px 12px; - /* min-width: 280px; - max-width: 500px; */ flex-direction: row; align-items: center; justify-content: space-between; diff --git a/src/components/feed/FeedDetailPost.tsx b/src/components/feed/FeedDetailPost.tsx index 1901650b..25cd8290 100644 --- a/src/components/feed/FeedDetailPost.tsx +++ b/src/components/feed/FeedDetailPost.tsx @@ -8,8 +8,6 @@ const Container = styled.div` display: flex; flex-direction: column; width: 100%; - /* min-width: 320px; - max-width: 540px; */ margin: 0 auto; padding: 40px 20px; gap: 16px; @@ -18,8 +16,6 @@ const Container = styled.div` const BorderBottom = styled.div` width: 94.8%; - /* min-width: 280px; - max-width: 500px; */ margin: 0 auto; padding: 0 20px; height: 6px; diff --git a/src/components/feed/FeedDetailPostBody.tsx b/src/components/feed/FeedDetailPostBody.tsx index 66dd0ba8..3faa9969 100644 --- a/src/components/feed/FeedDetailPostBody.tsx +++ b/src/components/feed/FeedDetailPostBody.tsx @@ -23,8 +23,8 @@ const PostContent = styled.div<{ hasImage: boolean }>` font-size: var(--string-size-medium01, 14px); font-weight: var(--string-weight-regular, 400); line-height: var(--string-lineheight-feedcontent_height20, 20px); - white-space: pre-wrap; // 개행문자 유지 - word-wrap: break-word; // 긴 텍스트 줄바꿈 + white-space: pre-wrap; + word-wrap: break-word; } .imgContainer { @@ -35,8 +35,8 @@ const PostContent = styled.div<{ hasImage: boolean }>` img { width: 100px; height: 100px; - flex-shrink: 0; //고정사이즈 - object-fit: cover; //비율 유지하며 이미지 채우기 + flex-shrink: 0; + object-fit: cover; cursor: pointer; } } @@ -74,7 +74,7 @@ const TagContainer = styled.div` `; interface FeedDetailPostBodyProps extends PostBodyProps { - tags?: string[]; // API에 없지만 컴포넌트에서 사용 + tags?: string[]; } const FeedDetailPostBody = ({ diff --git a/src/components/feed/FeedPost.tsx b/src/components/feed/FeedPost.tsx index 28d3105a..5c306017 100644 --- a/src/components/feed/FeedPost.tsx +++ b/src/components/feed/FeedPost.tsx @@ -8,8 +8,6 @@ const Container = styled.div` display: flex; flex-direction: column; width: 100%; - /* min-width: 320px; - max-width: 540px; */ margin: 0 auto; padding: 40px 20px; gap: 16px; @@ -18,8 +16,6 @@ const Container = styled.div` const BorderBottom = styled.div` width: 94.8%; - /* min-width: 280px; - max-width: 500px; */ margin: 0 auto; padding: 0 20px; height: 6px; diff --git a/src/components/feed/FollowList.tsx b/src/components/feed/FollowList.tsx index bb7d4106..5a6cb453 100644 --- a/src/components/feed/FollowList.tsx +++ b/src/components/feed/FollowList.tsx @@ -12,7 +12,6 @@ const FollowList = () => { const [myFollowings, setMyFollowings] = useState([]); const [loading, setLoading] = useState(true); - // API에서 최근 글 작성한 팔로우 리스트 조회 const fetchRecentFollowing = async () => { try { setLoading(true); @@ -21,7 +20,6 @@ const FollowList = () => { if (response.isSuccess) { setMyFollowings(response.data.myFollowingUsers); } else { - console.error('최근 팔로우 작성자 조회 실패:', response.message); setMyFollowings([]); } } catch (error) { @@ -32,7 +30,6 @@ const FollowList = () => { } }; - // 컴포넌트 마운트 시 데이터 조회 useEffect(() => { fetchRecentFollowing(); }, []); @@ -119,11 +116,10 @@ const FollowContainer = styled.div` overflow-y: hidden; gap: 12px; - /* ✅ 스크롤바 숨기기 */ - scrollbar-width: none; /* Firefox */ - -ms-overflow-style: none; /* IE, Edge */ + scrollbar-width: none; + -ms-overflow-style: none; .followerList::-webkit-scrollbar { - display: none; /* Chrome, Safari */ + display: none; } .followers { diff --git a/src/components/feed/MyFeed.tsx b/src/components/feed/MyFeed.tsx index 9aa5fab7..32c69e1c 100644 --- a/src/components/feed/MyFeed.tsx +++ b/src/components/feed/MyFeed.tsx @@ -14,7 +14,6 @@ const MyFeed = ({ showHeader, posts = [], isLast = false }: FeedListProps) => { const hasPosts = posts.length > 0; - // 프로필 데이터 로드 useEffect(() => { const loadProfile = async () => { try { @@ -32,10 +31,7 @@ const MyFeed = ({ showHeader, posts = [], isLast = false }: FeedListProps) => { }, []); if (loading || !profileData) { - return ( - <> - // - ); + return <>; } return ( @@ -73,7 +69,7 @@ const MyFeed = ({ showHeader, posts = [], isLast = false }: FeedListProps) => { const Container = styled.div` min-height: 100vh; padding-top: 136px; - padding-bottom: 125px; //이전 76px + padding-bottom: 125px; background-color: var(--color-black-main); `; diff --git a/src/components/feed/OtherFeed.tsx b/src/components/feed/OtherFeed.tsx index 25c9a4b6..d4ae5c80 100644 --- a/src/components/feed/OtherFeed.tsx +++ b/src/components/feed/OtherFeed.tsx @@ -18,7 +18,7 @@ interface OtherFeedProps { isMyFeed?: boolean; profileData?: OtherProfileData | null; userId?: number; - showFollowButton?: boolean; // showFollowButton prop 추가 + showFollowButton?: boolean; isMyself?: boolean; } @@ -34,7 +34,6 @@ const OtherFeed = ({ const [loading, setLoading] = useState(false); const [totalFeedCount, setTotalFeedCount] = useState(profileData?.totalFeedCount || 0); - // isMyself 값에 따라 적절한 API 호출 useEffect(() => { const loadFeeds = async () => { if (!userId) return; @@ -43,16 +42,13 @@ const OtherFeed = ({ setLoading(true); if (isMyself) { - // 자신의 피드인 경우 getMyFeeds와 getMyProfile 병렬 호출 const [feedsResponse, profileResponse] = await Promise.all([ getMyFeeds(), - getMyProfile() + getMyProfile(), ]); setFeedPosts(feedsResponse.data.feedList); - // getMyProfile에서 총 피드 수 업데이트 setTotalFeedCount(profileResponse.data.totalFeedCount); } else { - // 다른 사용자의 피드인 경우 getOtherFeed 호출 const response = await getOtherFeed(userId); setFeedPosts(response.data.feedList); } diff --git a/src/components/feed/Profile.tsx b/src/components/feed/Profile.tsx index 0538c2d6..adffceac 100644 --- a/src/components/feed/Profile.tsx +++ b/src/components/feed/Profile.tsx @@ -38,24 +38,14 @@ const Profile = ({ const toggleFollow = async () => { if (!userId) { - console.error('userId가 없습니다.'); return; } try { - console.log('현재 팔로우 상태:', followed); - console.log('요청할 타입:', !followed); - - // 현재 팔로우 상태의 반대값으로 API 호출 const response = await postFollow(userId, !followed); - console.log('API 응답:', response); - - // API 응답으로 팔로우 상태 업데이트 setFollowed(response.data.isFollowing); - console.log(`${nickname} - ${response.data.isFollowing ? '띱 완료' : '띱 취소'}`); - // Snackbar 표시 const message = response.data.isFollowing ? `${nickname}님을 띱 했어요.` : `${nickname}님을 띱 취소했어요.`; @@ -66,8 +56,7 @@ const Profile = ({ onClose: () => {}, }); } catch (error) { - console.error('팔로우/언팔로우 실패:', error); - // 에러 발생 시 상태 변경하지 않음 + console.error('띱하기 실패:', error); } }; @@ -102,8 +91,6 @@ const Container = styled.div` display: flex; flex-direction: column; width: 100%; - /* min-width: 320px; - max-width: 540px; */ height: 166px; padding: 0 20px; padding-top: 32px; diff --git a/src/components/feed/TabBar.tsx b/src/components/feed/TabBar.tsx index 66fadc2e..e48e960b 100644 --- a/src/components/feed/TabBar.tsx +++ b/src/components/feed/TabBar.tsx @@ -59,7 +59,6 @@ interface TabProps { } const TabBar = ({ tabs, activeTab, onTabClick }: TabProps) => { - // 현재 활성 탭의 인덱스 계산 const activeIndex = tabs.findIndex(tab => tab === activeTab); return ( @@ -73,7 +72,6 @@ const TabBar = ({ tabs, activeTab, onTabClick }: TabProps) => { {tab} ))} - {/* 슬라이드 애니메이션 밑줄 */} ); diff --git a/src/components/feed/TotalBar.tsx b/src/components/feed/TotalBar.tsx index 918bab15..ad3a90f9 100644 --- a/src/components/feed/TotalBar.tsx +++ b/src/components/feed/TotalBar.tsx @@ -2,8 +2,6 @@ import styled from '@emotion/styled'; const Container = styled.div` width: 100%; - /* min-width: 320px; - max-width: 540px; */ padding: 0 20px; margin: 0 auto; `; diff --git a/src/components/feed/TotalFeed.tsx b/src/components/feed/TotalFeed.tsx index ddb533c0..b44b5351 100644 --- a/src/components/feed/TotalFeed.tsx +++ b/src/components/feed/TotalFeed.tsx @@ -32,7 +32,7 @@ const TotalFeed = ({ showHeader, posts = [], isTotalFeed, isLast = false }: Feed const Container = styled.div` min-height: 100vh; padding-top: 136px; - padding-bottom: 125px; //이전 76px + padding-bottom: 125px; background-color: var(--color-black-main); `; diff --git a/src/components/feed/UserProfileItem.tsx b/src/components/feed/UserProfileItem.tsx index 931c0b09..42550655 100644 --- a/src/components/feed/UserProfileItem.tsx +++ b/src/components/feed/UserProfileItem.tsx @@ -36,11 +36,8 @@ const UserProfileItem = ({ try { const response = await postFollow(userId, !followed); - // API 응답으로 팔로우 상태 업데이트 setFollowed(response.data.isFollowing); - console.log(`${nickname} - ${response.data.isFollowing ? '띱 완료' : '띱 취소'}`); - // Snackbar 표시 const message = response.data.isFollowing ? `${nickname}님을 띱 했어요.` : `${nickname}님을 띱 취소했어요.`; @@ -85,8 +82,6 @@ const UserProfileItem = ({ const Wrapper = styled.div<{ isLast?: boolean }>` width: 100%; - /* max-width: 500px; - min-width: 320px; */ margin: 0 auto; height: 78px; padding: 20px 0; diff --git a/src/hooks/useReplyActions.ts b/src/hooks/useReplyActions.ts index 0810178f..fe8cd11c 100644 --- a/src/hooks/useReplyActions.ts +++ b/src/hooks/useReplyActions.ts @@ -25,13 +25,12 @@ export const useReplyActions = () => { const requestBody = { content, - isReplyRequest: isReplying, // 답글 여부 - parentId: isReplying ? parentId : null, // 답글이라면 부모 댓글 ID 포함 + isReplyRequest: isReplying, + parentId: isReplying ? parentId : null, postType: postType.toUpperCase() as 'FEED' | 'RECORD' | 'VOTE', }; try { - console.log('댓글or답글 작성 API 요청'); const response = await postReply(postId, requestBody); console.log('댓글 작성 성공:', response); if (onSuccess) onSuccess(); diff --git a/src/hooks/useSocialLoginToken.ts b/src/hooks/useSocialLoginToken.ts index 9a6afaf1..24b1104a 100644 --- a/src/hooks/useSocialLoginToken.ts +++ b/src/hooks/useSocialLoginToken.ts @@ -6,69 +6,53 @@ import { useAuthReadyStore } from '@/stores/useAuthReadyStore'; export const useSocialLoginToken = () => { const location = useLocation(); - // 토큰 발급 완료를 기다리는 Promise const tokenPromise = useRef | null>(null); const setReady = useAuthReadyStore(s => s.setReady); useEffect(() => { const handleSocialLoginToken = async (): Promise => { - // URL에서 loginTokenKey 가져오기 const params = new URLSearchParams(window.location.search); const loginTokenKey = params.get('loginTokenKey'); if (!loginTokenKey) { - console.log('🔑 loginTokenKey가 없습니다.'); return; } try { - console.log('🔑 소셜 로그인 토큰 발급 요청'); - console.log('📋 loginTokenKey:', loginTokenKey); - - // /auth/token API 호출하여 토큰 발급 (임시 토큰) const response = await getToken({ loginTokenKey }); if (response.isSuccess) { const { token, isNewUser } = response.data; if (isNewUser) { - // 회원가입 진행용 임시 토큰 저장 localStorage.setItem('preAuthToken', token); localStorage.removeItem('authToken'); - console.log('✅ 신규 사용자: 임시 토큰 저장 (회원가입 진행)'); } else { - // 기존 사용자: 액세스 토큰 저장 localStorage.setItem('authToken', token); localStorage.removeItem('preAuthToken'); - console.log('✅ 기존 사용자: 액세스 토큰 저장'); } - // URL에서 loginTokenKey 파라미터 제거 const newUrl = window.location.pathname; window.history.replaceState({}, document.title, newUrl); } else { - console.error('❌ 토큰 발급 실패:', response.message); + console.error('토큰 발급 실패:', response.message); } } catch (error) { - console.error('💥 토큰 발급 중 오류 발생:', error); + console.error('토큰 발급 중 오류 발생:', error); } - // 토큰 발급 시도 완료 시점에 ready true setReady(true); }; - // 소셜 로그인 후 리다이렉트된 경우에만 실행 const urlParams = new URLSearchParams(location.search); const isSocialLoginComplete = urlParams.get('loginTokenKey'); if (isSocialLoginComplete) { tokenPromise.current = handleSocialLoginToken(); } else { - // 로그인 리다이렉트 경로가 아니어도 이미 토큰이 있을 수 있음 → 바로 ready setReady(true); } }, [location.pathname, location.search, setReady]); - // 토큰 발급 완료를 기다리는 함수 반환 const waitForToken = useCallback(async (): Promise => { if (tokenPromise.current) { await tokenPromise.current; diff --git a/src/hooks/useUserSearch.ts b/src/hooks/useUserSearch.ts index 49fad7be..ae9867fa 100644 --- a/src/hooks/useUserSearch.ts +++ b/src/hooks/useUserSearch.ts @@ -58,7 +58,6 @@ export const useUserSearch = ({ [size, isFinalized], ); - // 디바운스된 키워드가 변경될 때 검색 실행 useEffect(() => { searchUsers(debouncedKeyword); }, [debouncedKeyword, searchUsers]); diff --git a/src/pages/Guide.tsx b/src/pages/Guide.tsx index 1bfe0396..96383254 100644 --- a/src/pages/Guide.tsx +++ b/src/pages/Guide.tsx @@ -3,7 +3,6 @@ import { useNavigate, useLocation } from 'react-router-dom'; import styled from '@emotion/styled'; import { colors, typography } from '@/styles/global/global'; -// Import guide images import guide1 from '@/assets/signup/guide1.svg'; import guide2 from '@/assets/signup/guide2.svg'; import guide3 from '@/assets/signup/guide3.svg'; @@ -26,43 +25,35 @@ const Guide = () => { const [touchEnd, setTouchEnd] = useState(null); const containerRef = useRef(null); - // SignupGenre에서 전달받은 모든 정보 const nickname = location.state?.nickname || '사용자'; const aliasName = location.state?.aliasName || '독서가'; const aliasColor = location.state?.aliasColor; const aliasIconUrl = location.state?.aliasIconUrl; - // 터치 시작 const handleTouchStart = (e: React.TouchEvent) => { setTouchStart(e.targetTouches[0].clientX); }; - // 터치 종료 const handleTouchEnd = (e: React.TouchEvent) => { setTouchEnd(e.changedTouches[0].clientX); }; - // 슬라이드 처리 useEffect(() => { if (!touchStart || !touchEnd) return; const distance = touchStart - touchEnd; - const isLeftSwipe = distance > 50; // 왼쪽으로 50px 이상 스와이프 - const isRightSwipe = distance < -50; // 오른쪽으로 50px 이상 스와이프 + const isLeftSwipe = distance > 50; + const isRightSwipe = distance < -50; if (isLeftSwipe && currentStep < guideSteps.length - 1) { - // 왼쪽으로 스와이프: 다음 단계 setCurrentStep(currentStep + 1); } else if (isRightSwipe && currentStep > 0) { - // 오른쪽으로 스와이프: 이전 단계 setCurrentStep(currentStep - 1); } - // 터치 상태 초기화 setTouchStart(null); setTouchEnd(null); }, [touchStart, touchEnd, currentStep]); - // 마우스 드래그 기능 const [mouseStart, setMouseStart] = useState(null); const [isDragging, setIsDragging] = useState(false); @@ -77,10 +68,8 @@ const Guide = () => { const distance = mouseStart - e.clientX; if (Math.abs(distance) > 50) { if (distance > 0 && currentStep < guideSteps.length - 1) { - // 왼쪽으로 드래그: 다음 단계 setCurrentStep(currentStep + 1); } else if (distance < 0 && currentStep > 0) { - // 오른쪽으로 드래그: 이전 단계 setCurrentStep(currentStep - 1); } setIsDragging(false); @@ -136,11 +125,9 @@ const Guide = () => { ]; const handleNext = () => { - // active 상태일 때만 다음 단계로 이동 if (currentStep < guideSteps.length - 1) { setCurrentStep(currentStep + 1); } else { - // 마지막 단계에서 완료 처리 - SignupDone으로 모든 정보 전달 navigate('/signup/done', { state: { nickName: nickname, @@ -222,7 +209,7 @@ const Container = styled.div<{ isDragging?: boolean }>` justify-content: center; background: ${colors.black.main}; color: ${colors.white}; - user-select: none; /* 텍스트 선택 방지 */ + user-select: none; cursor: ${({ isDragging }) => (isDragging ? 'grabbing' : 'grab')}; `; diff --git a/src/pages/feed/Feed.tsx b/src/pages/feed/Feed.tsx index 192e19f7..2e9b935e 100644 --- a/src/pages/feed/Feed.tsx +++ b/src/pages/feed/Feed.tsx @@ -21,10 +21,8 @@ const Feed = () => { const initialTabFromState = (location.state as { initialTab?: string } | null)?.initialTab; const [activeTab, setActiveTab] = useState(initialTabFromState ?? tabs[0]); - // 소셜 로그인 토큰 발급 처리 const { waitForToken } = useSocialLoginToken(); - // 최초 마운트 시에만 history state 제거하여 이후 재방문 시 영향 없도록 처리 useEffect(() => { if (initialTabFromState) { navigate('.', { replace: true }); @@ -32,21 +30,18 @@ const Feed = () => { // eslint-disable-next-line react-hooks/exhaustive-deps }, []); - // 전체 피드 상태 const [totalFeedPosts, setTotalFeedPosts] = useState([]); const [totalLoading, setTotalLoading] = useState(false); const [totalNextCursor, setTotalNextCursor] = useState(''); const [totalIsLast, setTotalIsLast] = useState(false); - // 내 피드 상태 const [myFeedPosts, setMyFeedPosts] = useState([]); const [myLoading, setMyLoading] = useState(false); const [myNextCursor, setMyNextCursor] = useState(''); const [myIsLast, setMyIsLast] = useState(false); - // 탭 전환 시 로딩 상태 const [tabLoading, setTabLoading] = useState(false); - // 초기 로딩 상태 (첫 진입 시) + const [initialLoading, setInitialLoading] = useState(true); const handleSearchButton = () => { @@ -57,23 +52,19 @@ const Feed = () => { navigate('/notice'); }; - // 전체 피드 로드 함수 const loadTotalFeeds = useCallback(async (_cursor?: string) => { try { setTotalLoading(true); - // cursor가 있으면 다음 페이지, 없으면 첫 페이지 const response = await getTotalFeeds(_cursor ? { cursor: _cursor } : undefined); if (_cursor) { - // 다음 페이지 데이터 추가 (무한 스크롤) - 중복 제거 setTotalFeedPosts(prev => { const existingIds = new Set(prev.map(post => post.feedId)); const newPosts = response.data.feedList.filter(post => !existingIds.has(post.feedId)); return [...prev, ...newPosts]; }); } else { - // 첫 페이지 데이터 설정 setTotalFeedPosts(response.data.feedList); } @@ -86,17 +77,14 @@ const Feed = () => { } }, []); - // 내 피드 로드 함수 const loadMyFeeds = useCallback(async (_cursor?: string) => { try { setMyLoading(true); const response = await getMyFeeds(_cursor ? { cursor: _cursor } : undefined); if (_cursor) { - // 다음 페이지 데이터 추가 setMyFeedPosts(prev => [...prev, ...response.data.feedList]); } else { - // 첫 페이지 데이터 설정 setMyFeedPosts(response.data.feedList); } @@ -109,7 +97,6 @@ const Feed = () => { } }, []); - // 다음 페이지 로드 (무한 스크롤용) const loadMoreFeeds = useCallback(() => { if (activeTab === '피드') { if (!totalIsLast && !totalLoading && totalNextCursor) { @@ -122,16 +109,13 @@ const Feed = () => { } }, [activeTab, totalIsLast, totalLoading, totalNextCursor, myIsLast, myLoading, myNextCursor]); - // 무한스크롤 구현 useEffect(() => { const handleScroll = () => { const isLoading = activeTab === '피드' ? totalLoading : myLoading; const isLastPage = activeTab === '피드' ? totalIsLast : myIsLast; - // 로딩 중이거나 마지막 페이지면 return if (isLoading || isLastPage) return; - // 스크롤이 하단 근처에 도달했는지 확인 (하단에서 200px 이전) const scrollTop = window.pageYOffset || document.documentElement.scrollTop; const windowHeight = window.innerHeight; const documentHeight = document.documentElement.scrollHeight; @@ -141,10 +125,8 @@ const Feed = () => { } }; - // 스크롤 이벤트 리스너 추가 window.addEventListener('scroll', handleScroll); - // 컴포넌트 언마운트 시 이벤트 리스너 제거 return () => { window.removeEventListener('scroll', handleScroll); }; @@ -154,10 +136,8 @@ const Feed = () => { window.scrollTo(0, 0); }, [activeTab]); - // 탭별로 API 호출 useEffect(() => { const loadFeedsWithToken = async () => { - // 토큰 발급 완료 대기 await waitForToken(); setTabLoading(true); diff --git a/src/pages/feed/FeedDetailPage.tsx b/src/pages/feed/FeedDetailPage.tsx index 6e336849..bb4efefa 100644 --- a/src/pages/feed/FeedDetailPage.tsx +++ b/src/pages/feed/FeedDetailPage.tsx @@ -26,7 +26,6 @@ const FeedDetailPage = () => { const { isReplying, replyContent, setReplyContent, submitComment, cancelReply } = useReplyActions(); const { nickname } = useReplyStore(); - // 댓글 목록을 다시 로드하는 함수 const reloadComments = useCallback(async () => { if (!feedId) return; @@ -34,7 +33,6 @@ const FeedDetailPage = () => { const commentsResponse = await getComments(Number(feedId), { postType: 'FEED' }); setCommentList(commentsResponse.data.commentList); - // 피드 데이터의 댓글 수를 실제 댓글 목록 길이로 업데이트 if (feedData) { setFeedData(prev => prev @@ -50,14 +48,12 @@ const FeedDetailPage = () => { } }, [feedId, feedData]); - // 페이지를 떠날 때 답글 상태 초기화 useEffect(() => { return () => { cancelReply(); }; }, [cancelReply]); - // 피드 상세 정보와 댓글 목록 로드 useEffect(() => { const loadFeedDetailAndComments = async () => { if (!feedId) { @@ -69,7 +65,6 @@ const FeedDetailPage = () => { try { setLoading(true); - // 피드 상세 정보와 댓글 목록을 병렬로 로드 const [feedResponse, commentsResponse] = await Promise.all([ getFeedDetail(Number(feedId)), getComments(Number(feedId), { postType: 'FEED' }), @@ -99,7 +94,6 @@ const FeedDetailPage = () => { const handleMoreClick = () => { if (feedData?.isWriter) { - // 작성자인 경우: 수정하기, 삭제하기 메뉴 openMoreMenu({ onEdit: () => { closePopup(); @@ -166,10 +160,8 @@ const FeedDetailPage = () => { }; const handleBackClick = () => { - // 새 탭에서 열린 경우 탭 닫기 window.close(); - // 만약 window.close()가 작동하지 않으면 (같은 도메인이 아닌 경우) 이전 페이지로 이동 if (window.opener) { window.close(); } else { diff --git a/src/pages/feed/FollowerListPage.tsx b/src/pages/feed/FollowerListPage.tsx index ac641ac0..8b03b6b9 100644 --- a/src/pages/feed/FollowerListPage.tsx +++ b/src/pages/feed/FollowerListPage.tsx @@ -15,7 +15,6 @@ const FollowerListPage = () => { const { type, userId } = useParams<{ type: UserProfileType; userId?: string }>(); const title = type === 'followerlist' ? '띱 목록' : '내 띱 목록'; - // 상태 관리 const [userList, setUserList] = useState([]); const [totalCount, setTotalCount] = useState(0); const [loading, setLoading] = useState(false); @@ -28,7 +27,6 @@ const FollowerListPage = () => { navigate(-1); }; - // API 호출 함수 const loadUserList = useCallback( async (cursor?: string) => { if (loading) return; @@ -39,19 +37,15 @@ const FollowerListPage = () => { let response; if (type === 'followerlist') { - // 띱 목록 API 호출 if (!userId) { - console.error('userId가 없습니다.'); setError('사용자 ID가 없습니다.'); return; } response = await getFollowerList(userId, { size: 10, cursor: cursor || null }); } else { - // 내 띱 목록 API 호출 response = await getFollowingList({ size: 10, cursor: cursor || null }); } - // type에 따라 적절한 데이터 추출 let userData: FollowData[] = []; if (type === 'followerlist') { userData = (response.data as { followers: FollowData[] })?.followers || []; @@ -59,27 +53,19 @@ const FollowerListPage = () => { userData = (response.data as { followings: FollowData[] })?.followings || []; } - console.log('API 응답:', response); - console.log('추출된 사용자 데이터:', userData); - - // API 응답이 유효한지 확인 if (!response || !response.data) { - console.error('API 응답이 없습니다.'); setError('API 응답이 없습니다.'); return; } if (cursor) { - // 다음 페이지 데이터 추가 (무한 스크롤) setUserList(prev => [...prev, ...userData]); } else { - // 첫 페이지 데이터 설정 setUserList(userData); } setNextCursor(response.data.nextCursor); setIsLast(response.data.isLast); - // 총합 카운트 설정 (API별 키 분기) if (type === 'followerlist') { const total = (response.data as { totalFollowerCount?: number }).totalFollowerCount; if (typeof total === 'number') setTotalCount(total); @@ -87,13 +73,11 @@ const FollowerListPage = () => { const total = (response.data as { totalFollowingCount?: number }).totalFollowingCount; if (typeof total === 'number') setTotalCount(total); } - // setTotalCount(prev => prev + userData.length); setRetryCount(0); } catch (error) { console.error('사용자 목록 로드 실패:', error); setError('사용자 목록을 불러오는데 실패했습니다.'); setRetryCount(prev => prev + 1); - // 에러 발생 시 로딩 상태를 false로 설정하여 무한 요청 방지 } finally { setLoading(false); } @@ -101,12 +85,9 @@ const FollowerListPage = () => { [type, userId], ); - // 무한 스크롤 구현 useEffect(() => { const handleScroll = () => { - // 로딩 중이거나 마지막 페이지이거나 에러가 있거나 재시도 횟수 초과시 요청하지 않음 if (loading || isLast || error || retryCount >= 3 || !nextCursor) { - console.log('스크롤 요청 차단:', { loading, isLast, error, retryCount, nextCursor }); return; } @@ -123,12 +104,10 @@ const FollowerListPage = () => { return () => window.removeEventListener('scroll', handleScroll); }, [isLast, error, retryCount, nextCursor, loadUserList]); - // 초기 데이터 로드 useEffect(() => { loadUserList(); }, [loadUserList]); - // 첫 페이지 높이가 뷰포트보다 작아 스크롤 이벤트가 발생하지 않는 경우 자동으로 다음 페이지를 프리페치 useEffect(() => { const doc = document.documentElement; const needsMore = doc.scrollHeight <= window.innerHeight + 100; @@ -201,7 +180,6 @@ const TotalBar = styled.div` const UserProfileList = styled.div` width: 100%; - /* 고정 헤더(TopBar) 영역을 제외한 최소 높이를 보장하여 하단 여백에도 배경이 비지 않도록 함 */ min-height: 100vh; background-color: var(--color-black-main); padding-top: 105px; diff --git a/src/pages/feed/MyFeedPage.tsx b/src/pages/feed/MyFeedPage.tsx index f3e975cb..39e5f954 100644 --- a/src/pages/feed/MyFeedPage.tsx +++ b/src/pages/feed/MyFeedPage.tsx @@ -28,7 +28,6 @@ const MyFeedPage = () => { navigate(-1); }; - // 다른 사용자 피드 및 프로필 데이터 로드 useEffect(() => { const loadOtherData = async () => { if (!userId) { @@ -45,9 +44,6 @@ const MyFeedPage = () => { getOtherProfile(Number(userId)), ]); - console.log('🔍 MyFeedPage - Profile Response:', profileResponse.data); - console.log('🔍 MyFeedPage - isWriter 값:', profileResponse.data.isWriter); - setFeedData(feedResponse.data.feedList); setProfileData(profileResponse.data); setError(null); @@ -82,7 +78,7 @@ const MyFeedPage = () => { posts={feedData} isMyFeed={true} profileData={profileData} - showFollowButton={false} // 띱하기 버튼 숨김 + showFollowButton={false} isMyself={true} /> diff --git a/src/pages/feed/OtherFeedPage.tsx b/src/pages/feed/OtherFeedPage.tsx index ea87a156..790e3a90 100644 --- a/src/pages/feed/OtherFeedPage.tsx +++ b/src/pages/feed/OtherFeedPage.tsx @@ -28,7 +28,6 @@ const OtherFeedPage = () => { navigate(-1); }; - // 다른 사용자 피드 및 프로필 데이터 로드 useEffect(() => { const loadOtherData = async () => { if (!userId) { @@ -40,7 +39,6 @@ const OtherFeedPage = () => { try { setLoading(true); - // 피드 데이터와 프로필 데이터를 병렬로 로드 const [feedResponse, profileResponse] = await Promise.all([ getOtherFeed(Number(userId)), getOtherProfile(Number(userId)), @@ -80,7 +78,7 @@ const OtherFeedPage = () => { posts={feedData} isMyFeed={false} profileData={profileData} - showFollowButton={!profileData?.isWriter} // isWriter가 true면 팔로우 버튼 숨김 + showFollowButton={!profileData?.isWriter} /> diff --git a/src/pages/feed/UserSearch.tsx b/src/pages/feed/UserSearch.tsx index bdae8112..fc34c5a0 100644 --- a/src/pages/feed/UserSearch.tsx +++ b/src/pages/feed/UserSearch.tsx @@ -28,19 +28,8 @@ const UserSearch = () => { const [recentSearches, setRecentSearches] = useState([]); const fetchRecentSearches = async () => { - try { - const response = await getRecentSearch('USER'); - - if (response.isSuccess) { - setRecentSearches(response.data.recentSearchList); - } else { - console.error('최근 검색어 조회 실패:', response.message); - setRecentSearches([]); - } - } catch (error) { - console.error('최근 검색어 조회 오류:', error); - setRecentSearches([]); - } + const response = await getRecentSearch('USER'); + setRecentSearches(response.data.recentSearchList); }; useEffect(() => { @@ -62,17 +51,10 @@ const UserSearch = () => { }; const handleDelete = async (recentSearchId: number) => { - try { - const response = await deleteRecentSearch(recentSearchId); - - if (response.isSuccess) { - // 삭제 성공 후 최근 검색어 리스트를 다시 호출 - await fetchRecentSearches(); - } else { - console.error('최근 검색어 삭제 실패:', response.message); - } - } catch (error) { - console.error('최근 검색어 삭제 오류:', error); + const response = await deleteRecentSearch(recentSearchId); + + if (response.isSuccess) { + await fetchRecentSearches(); } }; diff --git a/src/pages/feed/UserSearchResult.tsx b/src/pages/feed/UserSearchResult.tsx index 0c2049f5..d243404f 100644 --- a/src/pages/feed/UserSearchResult.tsx +++ b/src/pages/feed/UserSearchResult.tsx @@ -24,7 +24,6 @@ export function UserSearchResult({ else return false; }; - // 무한 스크롤을 위한 Intersection Observer const observerRef = useRef(null); useEffect(() => { @@ -81,8 +80,6 @@ const List = styled.div` display: flex; flex-direction: column; width: 100%; - /* min-width: 320px; - max-width: 540px; */ margin: 0 auto; margin-bottom: 72px; `; @@ -108,7 +105,7 @@ const EmptyWrapper = styled.div` text-align: center; font-size: var(--string-size-large01, 18px); font-weight: var(--string-weight-semibold, 600); - line-height: var(--string-lineheight-height24, 24px); /* 133.333% */ + line-height: var(--string-lineheight-height24, 24px); `; const ObserverDiv = styled.div` diff --git a/src/pages/index.tsx b/src/pages/index.tsx index d3fbb0e1..f74607bb 100644 --- a/src/pages/index.tsx +++ b/src/pages/index.tsx @@ -6,7 +6,6 @@ import { } from 'react-router-dom'; import Layout from '../components/common/Layout'; import Login from './login/Login'; -// import Signup from './signup/Signup'; import SignupGenre from './signup/SignupGenre'; import SignupNickname from './signup/SignupNickname'; import SignupDone from './signup/SignupDone'; diff --git a/src/pages/login/Login.tsx b/src/pages/login/Login.tsx index e60258d5..e6c7e5ef 100644 --- a/src/pages/login/Login.tsx +++ b/src/pages/login/Login.tsx @@ -7,24 +7,11 @@ import Google from '../../assets/login/google.svg'; import { Wrapper } from '@/components/common/Wrapper'; const Login = () => { - // const navigate = useNavigate(); - - // 이미 토큰이 있으면 /feed로 바로 이동 - // useEffect(() => { - // const authToken = localStorage.getItem('authToken'); - // if (authToken) { - // console.log('✅ 이미 토큰이 있어서 /feed로 바로 이동합니다.'); - // navigate('/feed'); - // } - // }, [navigate]); - const handleKakaoLogin = () => { - // 직접 카카오 로그인 URL로 리다이렉션 window.location.href = `${import.meta.env.VITE_API_BASE_URL}/oauth2/authorization/kakao`; }; const handleGoogleLogin = () => { - // 직접 구글 로그인 URL로 리다이렉션 window.location.href = `${import.meta.env.VITE_API_BASE_URL}/oauth2/authorization/google`; }; diff --git a/src/pages/mypage/AlertPage.tsx b/src/pages/mypage/AlertPage.tsx index e5df71d7..c6525836 100644 --- a/src/pages/mypage/AlertPage.tsx +++ b/src/pages/mypage/AlertPage.tsx @@ -12,8 +12,6 @@ const AlertPage = () => { const [toggleStates, setToggleStates] = useState({ push: true, - // feed: true, - // group: false, }); const handleBack = () => { @@ -36,8 +34,6 @@ const AlertPage = () => { const alertSettings = [ { key: 'push' as const, label: '푸시 알림', desc: '알림센터의 모든 알림을 포함해요' }, - // { key: 'feed' as const, label: '피드 알림', desc: '새로운 피드 소식을 알려드려요' }, - // { key: 'group' as const, label: '모임 알림', desc: '모임 관련 소식을 알려드려요' }, ]; return ( diff --git a/src/pages/mypage/EditPage.tsx b/src/pages/mypage/EditPage.tsx index 9456a47e..09ccfbbf 100644 --- a/src/pages/mypage/EditPage.tsx +++ b/src/pages/mypage/EditPage.tsx @@ -27,7 +27,6 @@ const EditPage = () => { .then(res => res.json()) .then((data: Genre[]) => { setGenres(data); - // aliasName과 일치하는 장르 찾기 (초기 로딩 시에만) if (selectedId === null) { const matchingGenre = data.find(g => g.subTitle === profile.aliasName); if (matchingGenre) { @@ -38,28 +37,13 @@ const EditPage = () => { .catch(console.error); }, []); - // nicknameError 상태 변경 추적 - useEffect(() => { - console.log('nicknameError 상태가 변경됨:', nicknameError); - }, [nicknameError]); + useEffect(() => {}, [nicknameError]); const onLeftClick = () => { navigate('/mypage'); }; const onRightClick = async () => { - // 닉네임 유효성 검사 - // if (nickname.trim() === '') { - // setNicknameError('변경할 닉네임을 입력해주세요.'); - // return; - // } - - // if (nickname === currentNickname) { - // setNicknameError('현재 닉네임과 같은 닉네임이에요.'); - // return; - // } - - // 선택된 장르 찾기 const selectedGenre = genres.find(g => g.id === selectedId); if (!selectedGenre) { console.error('선택된 장르를 찾을 수 없습니다.'); @@ -67,14 +51,12 @@ const EditPage = () => { } try { - // 프로필 업데이트 API 호출 const result = await patchProfile({ nickname: nickname, aliasName: selectedGenre.subTitle, }); if (result.isSuccess) { - // 성공 시 Mypage로 이동 navigate('/mypage'); } else { const errorMessage = result.message; @@ -91,7 +73,6 @@ const EditPage = () => { const filteredValue = inputValue.replace(/[^ㄱ-ㅎ가-힣a-z0-9]/g, ''); setNickname(filteredValue); - // 입력이 변경되면 에러 상태 초기화 if (nicknameError) { setNicknameError(''); } diff --git a/src/pages/mypage/Mypage.tsx b/src/pages/mypage/Mypage.tsx index 30dc04b9..123af3db 100644 --- a/src/pages/mypage/Mypage.tsx +++ b/src/pages/mypage/Mypage.tsx @@ -63,12 +63,10 @@ const Mypage = () => { title: '로그아웃', disc: '또 THIP 해주실거죠?', onConfirm: () => { - console.log('로그아웃 실행'); closePopup(); - logout(); // 실제 로그아웃 로직 실행 + logout(); }, onClose: () => { - console.log('로그아웃 취소'); closePopup(); }, }); diff --git a/src/pages/mypage/SavePage.tsx b/src/pages/mypage/SavePage.tsx index df2629cc..28d6e909 100644 --- a/src/pages/mypage/SavePage.tsx +++ b/src/pages/mypage/SavePage.tsx @@ -20,22 +20,18 @@ const SavePage = () => { const navigate = useNavigate(); const [activeTab, setActiveTab] = useState(tabs[0]); - // 피드 관련 상태 const [savedFeeds, setSavedFeeds] = useState([]); const [feedNextCursor, setFeedNextCursor] = useState(null); const [feedIsLast, setFeedIsLast] = useState(false); const [feedLoading, setFeedLoading] = useState(false); - // 책 관련 상태 const [savedBooks, setSavedBooks] = useState([]); const [bookNextCursor, setBookNextCursor] = useState(null); const [bookIsLast, setBookIsLast] = useState(false); const [bookLoading, setBookLoading] = useState(false); - // 초기 로딩 상태 const [initialLoading, setInitialLoading] = useState(true); - // Intersection Observer ref const feedObserverRef = useRef(null); const bookObserverRef = useRef(null); @@ -43,17 +39,14 @@ const SavePage = () => { navigate('/mypage'); }; - // 저장된 책 목록 로드 함수 (무한스크롤) const loadSavedBooks = useCallback(async (cursor: string | null = null) => { try { setBookLoading(true); const response = await getSavedBooksInMy(cursor); if (cursor === null) { - // 첫 로드 setSavedBooks(response.data.bookList); } else { - // 추가 로드 setSavedBooks(prev => [...prev, ...response.data.bookList]); } @@ -66,17 +59,14 @@ const SavePage = () => { } }, []); - // 저장된 피드 목록 로드 함수 const loadSavedFeeds = useCallback(async (cursor: string | null = null) => { try { setFeedLoading(true); const response = await getSavedFeedsInMy(cursor); if (cursor === null) { - // 첫 로드 setSavedFeeds(response.data.feedList); } else { - // 추가 로드 setSavedFeeds(prev => [...prev, ...response.data.feedList]); } @@ -89,7 +79,6 @@ const SavePage = () => { } }, []); - // 저장된 책 목록 로드 함수 const loadMoreBooks = useCallback(async () => { if (!bookNextCursor || bookIsLast || bookLoading) return; @@ -100,7 +89,6 @@ const SavePage = () => { } }, [bookNextCursor, bookIsLast, bookLoading, loadSavedBooks]); - // 책 Intersection Observer 콜백 const lastBookElementCallback = useCallback( (node: HTMLDivElement | null) => { if (bookLoading || bookIsLast) return; @@ -118,24 +106,20 @@ const SavePage = () => { [bookLoading, bookIsLast, loadMoreBooks], ); - // 페이지 진입 시 모든 데이터 로드 (한 번만 실행) useEffect(() => { const loadAllData = async () => { try { setInitialLoading(true); - // 두 API를 병렬로 호출 const [feedsResponse, booksResponse] = await Promise.all([ getSavedFeedsInMy(null), getSavedBooksInMy(), ]); - // 피드 데이터 설정 setSavedFeeds(feedsResponse.data.feedList); setFeedNextCursor(feedsResponse.data.nextCursor); setFeedIsLast(feedsResponse.data.isLast); - // 책 데이터 설정 setSavedBooks(booksResponse.data.bookList); setBookNextCursor(booksResponse.data.nextCursor); setBookIsLast(booksResponse.data.isLast); @@ -147,9 +131,8 @@ const SavePage = () => { }; loadAllData(); - }, []); // 빈 의존성 배열로 변경 + }, []); - // Intersection Observer 설정 (피드) useEffect(() => { const observer = new IntersectionObserver( entries => { @@ -181,29 +164,22 @@ const SavePage = () => { const newSaveState = !currentBook.isSaved; await postSaveBook(isbn, newSaveState); - // 저장 취소인 경우 저장된 책 목록을 다시 불러옴 if (!newSaveState) { await loadSavedBooks(); } else { - // 저장인 경우 로컬 상태만 업데이트 setSavedBooks(prev => prev.map(book => (book.isbn === isbn ? { ...book, isSaved: newSaveState } : book)), ); } - - console.log('저장 토글:', isbn, newSaveState); } catch (error) { console.error('저장 토글 실패:', error); } }; - // 피드 저장 토글 처리 const handleFeedSaveToggle = async (feedId: number, newSaveState: boolean) => { try { if (!newSaveState) { - // 저장 취소인 경우 리스트에서 제거 setSavedFeeds(prev => prev.filter(feed => feed.feedId !== feedId)); - console.log('피드 저장 취소 완료:', feedId); } } catch (error) { console.error('피드 저장 상태 변경 실패:', error); diff --git a/src/pages/notice/Notice.tsx b/src/pages/notice/Notice.tsx index 64c8ea0c..199ee13a 100644 --- a/src/pages/notice/Notice.tsx +++ b/src/pages/notice/Notice.tsx @@ -52,7 +52,6 @@ const Notice = () => { ); useEffect(() => { - // 탭 변경 시 첫 페이지부터 다시 로드 setNotifications([]); setNextCursor(null); setIsLast(false); @@ -88,22 +87,12 @@ const Notice = () => { const res = await postNotificationsCheck(notif.notificationId); if (!res.isSuccess) return; - // UI 즉시 반영: 읽음 처리 - // setNotifications(prev => - // prev.map(item => - // item.notificationId === notif.notificationId ? { ...item, isChecked: true } : item, - // ), - // ); - const { route, params } = res.data as { route: string; params?: Record }; - // 서버 라우팅 키 → 실제 앱 경로 매핑 switch (route) { - // 이동 없음 case 'NONE': break; - // 피드 1번 (해당유저 피드로 이동) case 'FEED_USER': { const userId = (params?.userId as number) ?? undefined; if (userId !== undefined) { @@ -112,7 +101,6 @@ const Notice = () => { break; } - // 피드 2~6번 (피드상세페이지로 이동) case 'FEED_DETAIL': { const feedId = (params?.feedId as number) ?? undefined; if (feedId !== undefined) { @@ -121,21 +109,18 @@ const Notice = () => { break; } - // 모임 (모집조기마감 or 모임시작) case 'ROOM_MAIN': { const roomId = (params?.roomId as number) ?? undefined; if (roomId !== undefined) navigate(`/group/detail/joined/${roomId}`); break; } - // host일때, 누군가 모임 참여를 눌렀을 때 case 'ROOM_DETAIL': { const roomId = (params?.roomId as number) ?? undefined; if (roomId !== undefined) navigate(`/group/detail/${roomId}`); break; } - // 모임방 -> 기록장 -> 해당 기록 필터링 화면으로 이동 case 'ROOM_POST_DETAIL': { const roomId = (params?.roomId as number) ?? undefined; const postId = (params?.postId as number) ?? undefined; @@ -159,7 +144,6 @@ const Notice = () => { break; } } catch (e) { - // noop: 실패 시 네비게이션 없이 무시 console.error('알림 확인 처리 실패:', e); } }; @@ -202,7 +186,6 @@ const Notice = () => { )} - {/* 무한 스크롤 감지용 센티넬 */} ); @@ -247,11 +230,10 @@ const NotificationList = styled.div` padding: 0 20px 20px 20px; width: 100%; overflow-y: auto; - /* Hide scrollbar but keep scroll */ - -ms-overflow-style: none; /* IE and Edge */ - scrollbar-width: none; /* Firefox */ + -ms-overflow-style: none; + scrollbar-width: none; &::-webkit-scrollbar { - display: none; /* Chrome, Safari, Opera */ + display: none; } `; diff --git a/src/pages/signup/SignupDone.tsx b/src/pages/signup/SignupDone.tsx index 3fd9f3f5..0d7d67bf 100644 --- a/src/pages/signup/SignupDone.tsx +++ b/src/pages/signup/SignupDone.tsx @@ -6,8 +6,6 @@ import TitleHeader from '../../components/common/TitleHeader'; const SignupDone = () => { const navigate = useNavigate(); const location = useLocation(); - - // SignupGenre에서 전달된 데이터 받기 const { nickName, aliasName, aliasColor, aliasIconUrl } = location.state || {}; const handleBackClick = () => { diff --git a/src/pages/signup/SignupGenre.tsx b/src/pages/signup/SignupGenre.tsx index 5364939c..b4273944 100644 --- a/src/pages/signup/SignupGenre.tsx +++ b/src/pages/signup/SignupGenre.tsx @@ -23,15 +23,11 @@ const SignupGenre = () => { const navigate = useNavigate(); const location = useLocation(); - // 소셜 로그인 토큰 발급 처리 useSocialLoginToken(); - // SignupNickname에서 넘어온 nickname 받기 const nickname = location.state?.nickname; - // 페이지 로드 시 간단한 확인 useEffect(() => { - // nickname이 없으면 이전 페이지로 돌아가기 if (!nickname) { navigate(-1); return; @@ -60,13 +56,8 @@ const SignupGenre = () => { }); if (result.isSuccess) { - console.log('🎉 회원가입 성공! 사용자 ID:', result.data.userId); - - // 회원가입 성공 시 새로운 access 토큰을 localStorage에 저장 if (result.data.accessToken) { localStorage.setItem('authToken', result.data.accessToken); - console.log('✅ 새로운 access 토큰이 localStorage에 저장되었습니다.'); - // 임시 토큰 제거 localStorage.removeItem('preAuthToken'); } diff --git a/src/pages/signup/SignupNickname.tsx b/src/pages/signup/SignupNickname.tsx index 19e82b3e..ccc5c18f 100644 --- a/src/pages/signup/SignupNickname.tsx +++ b/src/pages/signup/SignupNickname.tsx @@ -11,7 +11,6 @@ const SignupNickname = () => { const maxLength = 10; const navigate = useNavigate(); - // 소셜 로그인 토큰 발급 처리 const { waitForToken } = useSocialLoginToken(); const isNextActive = nickname.length >= 2 && nickname.length <= maxLength; @@ -24,31 +23,20 @@ const SignupNickname = () => { if (!isNextActive) return; setError(''); - console.log('=== 🚀 닉네임 검증 시작 ==='); - console.log('👤 입력된 닉네임:', nickname); - try { - // 토큰 발급 완료 대기 await waitForToken(); - // 임시 토큰 존재 여부 확인 (회원가입 진행 중) const preAuthToken = localStorage.getItem('preAuthToken'); if (!preAuthToken) { - console.log('❌ 임시 토큰이 없어 닉네임 검증을 할 수 없습니다.'); setError('인증 토큰이 없습니다. 다시 시도해주세요.'); return; } - console.log('✅ 임시 토큰 확인 완료, 닉네임 검증 API 호출'); const result = await postNickname(nickname); if (result.data.isVerified) { - console.log('✅ 닉네임 검증 성공!'); - // 닉네임 검증 성공 - 다음 단계로 진행 navigate('/signup/genre', { state: { nickname } }); } else { - console.log('❌ 닉네임 검증 실패 - 이미 사용중'); - // 닉네임 검증 실패 - 우리가 정한 에러 메시지 setError('이미 사용중인 닉네임이에요.'); } } catch (error) { diff --git a/vite.config.ts b/vite.config.ts index 8fa8a4c1..48b7fe86 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -9,7 +9,6 @@ export default defineConfig(({ mode }) => ({ '@': path.resolve(__dirname, './src'), }, }, - // production 빌드에서 console.log/info/debug 제거 (error/warn 유지) esbuild: mode === 'production' ? {