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