From 6d92bd29a223c2a3d9b2ae2004105c8581e56ec7 Mon Sep 17 00:00:00 2001 From: leejeongho Date: Sat, 31 Aug 2024 02:30:45 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=EC=9E=90=EA=B8=B0=EC=86=8C=EA=B0=9C=20?= =?UTF-8?q?=EC=88=98=EC=A0=95=20=EC=B4=88=EA=B8=B0=20=EB=8D=B0=EC=9D=B4?= =?UTF-8?q?=ED=84=B0=20=EB=A1=9C=EC=A7=81=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../apis/schema/MeetingMemberResponse.ts | 1 + .../components/Form/IntroInfoForm.tsx | 1 - .../components/ModifyIntroForm.tsx | 1 - .../containers/ModifyUserInfoContainer.tsx | 34 ++++++++++++++++--- 4 files changed, 31 insertions(+), 6 deletions(-) diff --git a/packages/web-domains/src/about-me/common/apis/schema/MeetingMemberResponse.ts b/packages/web-domains/src/about-me/common/apis/schema/MeetingMemberResponse.ts index e22b9ffb..60711083 100644 --- a/packages/web-domains/src/about-me/common/apis/schema/MeetingMemberResponse.ts +++ b/packages/web-domains/src/about-me/common/apis/schema/MeetingMemberResponse.ts @@ -8,6 +8,7 @@ export interface MeetingMemberResponse { job: string; location: string; hobbies?: Array; + hobbyDetails?: Array<{ hobbyId: number; content: string }>; mbti?: string; introduction?: string; } diff --git a/packages/web-domains/src/user/features/get-user-info/components/Form/IntroInfoForm.tsx b/packages/web-domains/src/user/features/get-user-info/components/Form/IntroInfoForm.tsx index 48a73e09..890fe472 100644 --- a/packages/web-domains/src/user/features/get-user-info/components/Form/IntroInfoForm.tsx +++ b/packages/web-domains/src/user/features/get-user-info/components/Form/IntroInfoForm.tsx @@ -70,7 +70,6 @@ export const IntroInfoForm = () => { placeholder="저는 이런 사람이에요" {...register('introduction', { maxLength: MAX_LENGTH, - validate: (value) => (value.trim().length >= 1 ? true : false), })} /> diff --git a/packages/web-domains/src/user/features/modify-user-info/components/ModifyIntroForm.tsx b/packages/web-domains/src/user/features/modify-user-info/components/ModifyIntroForm.tsx index 1e998a71..bd70046e 100644 --- a/packages/web-domains/src/user/features/modify-user-info/components/ModifyIntroForm.tsx +++ b/packages/web-domains/src/user/features/modify-user-info/components/ModifyIntroForm.tsx @@ -28,7 +28,6 @@ export const ModifyIntroForm = () => { maxLength={MAX_LENGTH} {...register('introduction', { maxLength: MAX_LENGTH, - validate: (value) => (value.trim().length >= 1 ? true : false), })} /> diff --git a/packages/web-domains/src/user/features/modify-user-info/containers/ModifyUserInfoContainer.tsx b/packages/web-domains/src/user/features/modify-user-info/containers/ModifyUserInfoContainer.tsx index d93fd901..4b669ed4 100644 --- a/packages/web-domains/src/user/features/modify-user-info/containers/ModifyUserInfoContainer.tsx +++ b/packages/web-domains/src/user/features/modify-user-info/containers/ModifyUserInfoContainer.tsx @@ -1,7 +1,9 @@ 'use client'; -import { notFound, redirect, useSearchParams } from 'next/navigation'; +import { useParams, useSearchParams, useRouter } from 'next/navigation'; +import { useEffect } from 'react'; +import { useGetMemberMe } from '@/about-me/common/apis/queries/useGetMemberMe'; import { STEPS } from '@/user/common/constants/step'; import { GetUserBasicInfoContainer } from '../../get-user-info/containers/GetUserBasicInfoContainer'; @@ -12,11 +14,35 @@ import { GetUserMbtiContainer } from '../../get-user-info/containers/GetUserMbti import { ModifyUserIntroContainer } from './ModifyUserIntroContainer'; export const ModifyUserInfoContainer = () => { + const { meetingId } = useParams(); const searchParams = useSearchParams(); + const router = useRouter(); const step = searchParams.get('step'); - if (!step) { - redirect(`?step=${STEPS.BASIC_INFO}`); + const { data: memberMe, isLoading } = useGetMemberMe({ meetingId: Number(meetingId) }); + + useEffect(() => { + if (memberMe && !step) { + const params = new URLSearchParams(); + params.append('step', STEPS.BASIC_INFO); + params.append('userName', memberMe?.name); + params.append('birth', memberMe?.birth.replaceAll('-', '')); + params.append('gender', memberMe.gender); + params.append('job', memberMe.job); + params.append('location', memberMe.location); + if (memberMe.mbti) { + params.append('mbti', memberMe.mbti); + } + if (memberMe.hobbyDetails && memberMe.hobbyDetails.length > 0) { + const hobbyIds = memberMe.hobbyDetails.map((hobby) => hobby.hobbyId).toString(); + params.append('hobbyIds', hobbyIds); + } + router.replace(`?${params.toString()}`); + } + }, [memberMe, step]); + + if (!step || isLoading) { + return null; } switch (step) { @@ -31,6 +57,6 @@ export const ModifyUserInfoContainer = () => { case STEPS.INTRO_INFO: return ; default: - notFound(); + return ; } };