From 84f80f12c6afc7d309498af604981cd30756ed5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A0=95=EC=9E=AC=ED=9D=AC?= Date: Tue, 28 Nov 2023 11:46:58 +0900 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20=EB=B0=B1=EC=97=94=EB=93=9C?= =?UTF-8?q?=EC=99=80=20=EA=B8=B0=EC=A4=80=20=ED=86=B5=EC=9D=BC=20=EB=B0=8F?= =?UTF-8?q?=20=EB=B6=88=ED=95=84=EC=9A=94=ED=95=9C=20=EC=BD=94=EB=93=9C=20?= =?UTF-8?q?=EC=A0=95=EB=A6=AC=20(#126)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * :sparkles: 백엔드와 validation 기준 통일 * :fire: 사용되지 않는 코드 및 콘솔 삭제 --- .../(auth)/login/components/RouteCallback.tsx | 1 - .../(routes)/(auth)/login/google/page.tsx | 1 - .../(routes)/(auth)/login/kakao/page.tsx | 1 - .../(home)/components/PopularCardSection.tsx | 3 +- .../(routes)/(home)/components/TestBlock.tsx | 22 ------------- .../description-section/MoreButton.tsx | 1 - .../modify/hooks/useCardModifyForm.ts | 8 ----- .../(root)/(routes)/cards/[cardId]/page.tsx | 1 - .../MyCardListContent.tsx | 3 +- .../trade-status-tabs/TradeStatusTabs.tsx | 2 +- .../cards/new/hooks/useCardUploadForm.ts | 2 -- .../(routes)/chatrooms/[chatRoomId]/page.tsx | 1 - .../(routes)/dibs/components/MyDibsList.tsx | 1 - .../dibs/components/MyDibsTemplate.tsx | 1 - .../(routes)/mypage/components/UserInfo.tsx | 2 -- .../NotificationStatusTabs.tsx | 4 +-- .../MyCardDescriptionSection.tsx | 2 -- .../my-suggestion-card/MySuggestionCard.tsx | 2 +- .../SuggestionStatusTabs.tsx | 4 +-- .../domain/image-uploader/ImageUploader.tsx | 3 -- .../domain/text-editable/TextEditable.tsx | 33 +++++++++++++++---- src/config/appValidation.ts | 8 ++--- src/hooks/useDibs.ts | 6 ++-- src/hooks/useToast.tsx | 2 +- src/hooks/useValidate.ts | 1 - src/lib/msw/mocks/handlers.ts | 1 - src/lib/msw/mocks/historyHandlers.ts | 2 +- src/lib/msw/mocks/suggestionHandlers.ts | 2 +- src/middleware.ts | 4 --- src/services/card/card.ts | 1 - src/services/suggestion/suggestion.ts | 1 - src/services/user/user.ts | 1 - src/utils/getServerCookie.ts | 2 +- 33 files changed, 44 insertions(+), 85 deletions(-) delete mode 100644 src/app/(root)/(routes)/(home)/components/TestBlock.tsx diff --git a/src/app/(root)/(routes)/(auth)/login/components/RouteCallback.tsx b/src/app/(root)/(routes)/(auth)/login/components/RouteCallback.tsx index c9038ef4..de6469f0 100644 --- a/src/app/(root)/(routes)/(auth)/login/components/RouteCallback.tsx +++ b/src/app/(root)/(routes)/(auth)/login/components/RouteCallback.tsx @@ -6,7 +6,6 @@ import { useRouter } from 'next/navigation' import AppPath from '@/config/appPath' import { Environment } from '@/config/environment' import { useToast } from '@/hooks/useToast' -import apiClient from '@/services/apiClient' import { User } from '@/types/user' type RouteCallbackProps = { diff --git a/src/app/(root)/(routes)/(auth)/login/google/page.tsx b/src/app/(root)/(routes)/(auth)/login/google/page.tsx index 978942e3..be7b55b2 100644 --- a/src/app/(root)/(routes)/(auth)/login/google/page.tsx +++ b/src/app/(root)/(routes)/(auth)/login/google/page.tsx @@ -12,7 +12,6 @@ async function getGoogleAccessToken(code: string) { const response = await getGoogleRedirect(escape(code)) return response } catch (e) { - console.log(e) return null } } diff --git a/src/app/(root)/(routes)/(auth)/login/kakao/page.tsx b/src/app/(root)/(routes)/(auth)/login/kakao/page.tsx index 9f30d4fd..0d19c646 100644 --- a/src/app/(root)/(routes)/(auth)/login/kakao/page.tsx +++ b/src/app/(root)/(routes)/(auth)/login/kakao/page.tsx @@ -12,7 +12,6 @@ async function getKakaoAccessToken(code: string) { const response = await getKakaoRedirect(escape(code)) return response } catch (e) { - console.log(e) return null } } diff --git a/src/app/(root)/(routes)/(home)/components/PopularCardSection.tsx b/src/app/(root)/(routes)/(home)/components/PopularCardSection.tsx index 64ffcdd5..0fbf768a 100644 --- a/src/app/(root)/(routes)/(home)/components/PopularCardSection.tsx +++ b/src/app/(root)/(routes)/(home)/components/PopularCardSection.tsx @@ -7,7 +7,6 @@ async function getPopularCardValue() { const data = await res return data.data } catch (error: any) { - console.log(error) throw new Error(error.message) } } @@ -17,7 +16,7 @@ const PopularCardSection = async () => { return ( data && ( -
+
오늘의 인기 물건
diff --git a/src/app/(root)/(routes)/(home)/components/TestBlock.tsx b/src/app/(root)/(routes)/(home)/components/TestBlock.tsx deleted file mode 100644 index 4622e8d0..00000000 --- a/src/app/(root)/(routes)/(home)/components/TestBlock.tsx +++ /dev/null @@ -1,22 +0,0 @@ -// 'use client' -import React from 'react' -import { getTest } from '@/services/test/test' - -async function getTestValue() { - const res = await getTest() - return res -} - -export default async function TestBlock() { - const data = await getTestValue() - - // useEffect(() => { - // async function fetchData() { - // const data = await getTest() - // console.log(await data.json()) - // } - // fetchData() - // }, []) - - return
{'index ' + data?.message}
-} diff --git a/src/app/(root)/(routes)/cards/[cardId]/components/description-section/MoreButton.tsx b/src/app/(root)/(routes)/cards/[cardId]/components/description-section/MoreButton.tsx index 038cbe7e..ebef673a 100644 --- a/src/app/(root)/(routes)/cards/[cardId]/components/description-section/MoreButton.tsx +++ b/src/app/(root)/(routes)/cards/[cardId]/components/description-section/MoreButton.tsx @@ -58,7 +58,6 @@ const MoreButton = ({ cardId, status }: MoreButtonProps) => { if (shouldRedirect) { router.push(shouldRedirect) } else { - console.log(shouldRedirect, error) toast({ title: '삭제를 실패했습니다', duration: 2000, diff --git a/src/app/(root)/(routes)/cards/[cardId]/modify/hooks/useCardModifyForm.ts b/src/app/(root)/(routes)/cards/[cardId]/modify/hooks/useCardModifyForm.ts index cd6eb307..10d96b56 100644 --- a/src/app/(root)/(routes)/cards/[cardId]/modify/hooks/useCardModifyForm.ts +++ b/src/app/(root)/(routes)/cards/[cardId]/modify/hooks/useCardModifyForm.ts @@ -1,12 +1,8 @@ import { useState } from 'react' import { useForm } from 'react-hook-form' import { zodResolver } from '@hookform/resolvers/zod' -import { QueryClient, useQueryClient } from '@tanstack/react-query' -import Cookies from 'js-cookie' import { useRouter } from 'next/navigation' import AppPath from '@/config/appPath' -import { Environment } from '@/config/environment' -import { useAuth } from '@/contexts/AuthProvider' import { useToast } from '@/hooks/useToast' import { putCard } from '@/services/card/card' import { @@ -39,7 +35,6 @@ export const useCardModifyForm = ({ }) const [isSubmitting, setIsSubmitting] = useState(false) - const queryClient = useQueryClient() const onSubmit = async (data: CardUploadFormValues) => { if (isSubmitting) return setIsSubmitting(() => true) @@ -62,9 +57,6 @@ export const useCardModifyForm = ({ }) } finally { setIsSubmitting(() => false) - // queryClient.invalidateQueries({ - // queryKey: [cardId, 'cardInfo'], - // }) } } diff --git a/src/app/(root)/(routes)/cards/[cardId]/page.tsx b/src/app/(root)/(routes)/cards/[cardId]/page.tsx index b8417195..1ea73527 100644 --- a/src/app/(root)/(routes)/cards/[cardId]/page.tsx +++ b/src/app/(root)/(routes)/cards/[cardId]/page.tsx @@ -20,7 +20,6 @@ const CardPage = ({ params }: CardPageProps) => { const router = useRouter() const { data } = useCardInfoQuery(Number(params.cardId), isLoggedIn) const cardData = data?.data - console.log(cardData) return (
diff --git a/src/app/(root)/(routes)/cards/my/components/my-card-list-content/MyCardListContent.tsx b/src/app/(root)/(routes)/cards/my/components/my-card-list-content/MyCardListContent.tsx index 133f488c..44656472 100644 --- a/src/app/(root)/(routes)/cards/my/components/my-card-list-content/MyCardListContent.tsx +++ b/src/app/(root)/(routes)/cards/my/components/my-card-list-content/MyCardListContent.tsx @@ -2,7 +2,6 @@ import { useEffect, useRef, useState } from 'react' import ExceptionBoundary from '@/components/domain/exception-boundary' -import MaxWidthWrapper from '@/components/domain/max-width-wrapper' import { useMyCardsQuery } from '@/hooks/api/queries/useMyCardsQuery' import { useIntersectionObserver } from '@/hooks/useIntersectionObserver' import { TradeStatus } from '@/types/card' @@ -33,7 +32,7 @@ const MyCardListContent = () => { const isEmpty = data?.pages[0].data.cardList.length === 0 return ( <> -
+
void + setTradeStatus: (_tradeStatus: TradeStatus) => void } const TradeStatusTabs = ({ diff --git a/src/app/(root)/(routes)/cards/new/hooks/useCardUploadForm.ts b/src/app/(root)/(routes)/cards/new/hooks/useCardUploadForm.ts index b045eb00..3e70bff3 100644 --- a/src/app/(root)/(routes)/cards/new/hooks/useCardUploadForm.ts +++ b/src/app/(root)/(routes)/cards/new/hooks/useCardUploadForm.ts @@ -61,8 +61,6 @@ export const useCardUploadForm = () => { title: 'Error', description: '게시글을 업로드하는데 실패했습니다.', }) - console.log(error) - console.log(await error.response.json()) } finally { setIsSubmitting(() => false) } diff --git a/src/app/(root)/(routes)/chatrooms/[chatRoomId]/page.tsx b/src/app/(root)/(routes)/chatrooms/[chatRoomId]/page.tsx index 2c765bb8..4a7e8d5b 100644 --- a/src/app/(root)/(routes)/chatrooms/[chatRoomId]/page.tsx +++ b/src/app/(root)/(routes)/chatrooms/[chatRoomId]/page.tsx @@ -75,7 +75,6 @@ const ChatPage = async ({ params }: ChatPageProps) => { initialChatRoom.fromCardInfo, initialChatRoom.toCardInfo, ] - console.log(suggestionDataArray) const myCardId = suggestionDataArray.find( (obj) => obj.userInfo.userId === initialUserInfo.userId, ).cardInfo.cardId diff --git a/src/app/(root)/(routes)/dibs/components/MyDibsList.tsx b/src/app/(root)/(routes)/dibs/components/MyDibsList.tsx index 60d5282d..8a13c064 100644 --- a/src/app/(root)/(routes)/dibs/components/MyDibsList.tsx +++ b/src/app/(root)/(routes)/dibs/components/MyDibsList.tsx @@ -9,7 +9,6 @@ const MyDibsList = ({ }: { data: InfiniteData | undefined }) => { - console.log(data?.pages) return ( <> {data?.pages.map(({ data: { dibList } }: GetMyDibsRes, pageIndex) => ( diff --git a/src/app/(root)/(routes)/dibs/components/MyDibsTemplate.tsx b/src/app/(root)/(routes)/dibs/components/MyDibsTemplate.tsx index 9f48f608..0800d43e 100644 --- a/src/app/(root)/(routes)/dibs/components/MyDibsTemplate.tsx +++ b/src/app/(root)/(routes)/dibs/components/MyDibsTemplate.tsx @@ -9,7 +9,6 @@ import MyDibsList from './MyDibsList' const MyDibsTemplate = () => { const { data, fetchNextPage, isLoading, isError, isFetchingNextPage } = useMyDibsQuery() - console.log(data) const lastElementRef = useRef(null) const entry = useIntersectionObserver(lastElementRef, { threshold: 1.0 }) diff --git a/src/app/(root)/(routes)/mypage/components/UserInfo.tsx b/src/app/(root)/(routes)/mypage/components/UserInfo.tsx index 18720d94..aab11d81 100644 --- a/src/app/(root)/(routes)/mypage/components/UserInfo.tsx +++ b/src/app/(root)/(routes)/mypage/components/UserInfo.tsx @@ -26,7 +26,6 @@ const UserInfo = ({ user }: UserInfoProps) => { return resProfile.data } catch (error) { setIsProfileChanged(false) - console.log(error) toast({ title: '프로필 이미지 변경 실패', description: '프로필 이미지 변경에 실패했습니다.', @@ -43,7 +42,6 @@ const UserInfo = ({ user }: UserInfoProps) => { return res.data } catch (error) { setIsNicknameChanged(false) - console.log(error) toast({ title: '닉네임 변경 실패', description: '닉네임 변경에 실패했습니다.', diff --git a/src/app/(root)/(routes)/notifications/components/notification-status-tabs/NotificationStatusTabs.tsx b/src/app/(root)/(routes)/notifications/components/notification-status-tabs/NotificationStatusTabs.tsx index 8373b18c..5e0f09f9 100644 --- a/src/app/(root)/(routes)/notifications/components/notification-status-tabs/NotificationStatusTabs.tsx +++ b/src/app/(root)/(routes)/notifications/components/notification-status-tabs/NotificationStatusTabs.tsx @@ -1,7 +1,7 @@ import { Tabs, TabsList, TabsTrigger } from '@/components/ui/tabs' type NotificationStatusTabsProps = { - setIsRead: (isRead: boolean) => void + setIsRead: (_isRead: boolean) => void } const NotificationStatusTabs = ({ setIsRead }: NotificationStatusTabsProps) => { @@ -12,7 +12,7 @@ const NotificationStatusTabs = ({ setIsRead }: NotificationStatusTabsProps) => { return ( void + handleMySuggestionUpdate: (_isAccepted: boolean) => void }) => ( <> void - setDirectionTypeState: (directionTypeState: DirectionType) => void + setSuggestionTypeState: (_suggestionTypeState: SuggestionType) => void + setDirectionTypeState: (_directionTypeState: DirectionType) => void } const SuggestionStatusTabs = ({ diff --git a/src/components/domain/image-uploader/ImageUploader.tsx b/src/components/domain/image-uploader/ImageUploader.tsx index 027f0ae4..b4df1041 100644 --- a/src/components/domain/image-uploader/ImageUploader.tsx +++ b/src/components/domain/image-uploader/ImageUploader.tsx @@ -1,8 +1,6 @@ 'use client' import React, { useState } from 'react' -import Cookies from 'js-cookie' -import { Environment } from '@/config/environment' import { MAX_IMAGE_NUMBER } from '@/constants/image' import { useToast } from '@/hooks/useToast' import { postImageFile } from '@/services/images' @@ -86,7 +84,6 @@ const ImageUploader = ({ isDeletable={isImageDeletable} isThumbnail={isThumbnail} onDeleteHandler={() => { - console.log(images) setImages(images.filter((_, i) => i !== index)) onFilesChanged(images.filter((_, i) => i !== index)) }} diff --git a/src/components/domain/text-editable/TextEditable.tsx b/src/components/domain/text-editable/TextEditable.tsx index f20a92f5..ae314445 100644 --- a/src/components/domain/text-editable/TextEditable.tsx +++ b/src/components/domain/text-editable/TextEditable.tsx @@ -5,6 +5,7 @@ import Image from 'next/image' import Button from '@/components/ui/button' import Input from '@/components/ui/input' import Assets from '@/config/assets' +import { useToast } from '@/hooks/useToast' import { cn } from '@/utils' type TextEditablePropsType = { @@ -20,9 +21,9 @@ const TextEditable = ({ }: TextEditablePropsType) => { const [isEditing, setIsEditing] = useState(false) const [value, setValue] = useState(defaultText) + const { toast } = useToast() useEffect(() => { - console.log('이름', defaultText) if (!changedSuccessfully) { setValue(() => defaultText) } @@ -32,6 +33,29 @@ const TextEditable = ({ setValue(event.target.value) } + const onSubmit = () => { + if (isEditing) { + if (value.length < 2) { + toast({ + title: '닉네임 변경 실패', + description: '닉네임은 2자 이상 입력해주세요.', + variant: 'destructive', + }) + return + } + if (value.length > 20) { + toast({ + title: '닉네임 변경 실패', + description: '닉네임은 20자까지 입력해주세요.', + variant: 'destructive', + }) + return + } + onChangeHandler(value) + } + setIsEditing((prev) => !prev) + } + return (