Skip to content

Commit

Permalink
fix: 수정시 introduction searchParams 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
LeeJeongHooo committed Sep 9, 2024
1 parent b114904 commit 4a6ccda
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -13,11 +14,13 @@ export interface IntroFormType {
const MAX_LENGTH = 3000;

export const ModifyIntroForm = () => {
const searchParams = useSearchParams();

const {
register,
formState: { isValid },
handleSubmit,
} = useForm<IntroFormType>({ defaultValues: { introduction: '' } });
} = useForm<IntroFormType>({ defaultValues: { introduction: searchParams.get('introduction') || '' } });

const { handleModifyUserInfo } = useModifyUserInfoService();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
Expand Down

0 comments on commit 4a6ccda

Please sign in to comment.