From 4a6ccda866434febbda6083e9b8c7a157329e77e Mon Sep 17 00:00:00 2001 From: leejeongho Date: Tue, 10 Sep 2024 05:13:54 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=EC=88=98=EC=A0=95=EC=8B=9C=20introducti?= =?UTF-8?q?on=20searchParams=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../features/modify-user-info/components/ModifyIntroForm.tsx | 5 ++++- .../modify-user-info/containers/ModifyUserInfoContainer.tsx | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) 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 bd70046e..41c5aeb2 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 @@ -1,5 +1,6 @@ import { Txt, Button } from '@sds/components'; import { colors } from '@sds/theme'; +import { useSearchParams } from 'next/navigation'; import { useForm } from 'react-hook-form'; import { buttonWrapperCss } from '../../get-user-info/components/Form/styles'; @@ -13,11 +14,13 @@ export interface IntroFormType { const MAX_LENGTH = 3000; export const ModifyIntroForm = () => { + const searchParams = useSearchParams(); + const { register, formState: { isValid }, handleSubmit, - } = useForm({ defaultValues: { introduction: '' } }); + } = useForm({ defaultValues: { introduction: searchParams.get('introduction') || '' } }); const { handleModifyUserInfo } = useModifyUserInfoService(); 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 4b669ed4..b570c9a2 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 @@ -37,6 +37,9 @@ export const ModifyUserInfoContainer = () => { const hobbyIds = memberMe.hobbyDetails.map((hobby) => hobby.hobbyId).toString(); params.append('hobbyIds', hobbyIds); } + if (memberMe.introduction) { + params.append('introduction', memberMe.introduction); + } router.replace(`?${params.toString()}`); } }, [memberMe, step]);