Skip to content

Commit

Permalink
feat: (#205) 선택한 카테고리 아이디 리스트 api에 보내기
Browse files Browse the repository at this point in the history
  • Loading branch information
chsua committed Aug 2, 2023
1 parent 113d5a5 commit 53f6bd6
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions frontend/src/components/PostForm/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ export default function PostForm({ data, mutate, isError, error }: PostFormProps

const { text: writingTitle, handleTextChange: handleTitleChange } = useText(title ?? '');
const { text: writingContent, handleTextChange: handleContentChange } = useText(content ?? '');
const { selectedOptionList, handleOptionAdd, handleOptionDelete } = useMultiSelect(
categoryIds ?? [],
CATEGORY_COUNT_LIMIT
);

const handleDeadlineButtonClick = (option: string) => {
setTime(formatTimeWithOption(option));
Expand Down Expand Up @@ -117,7 +121,7 @@ export default function PostForm({ data, mutate, isError, error }: PostFormProps
});

const updatedPostTexts = {
categoryIds: [1, 2],
categoryIds: selectedOptionList.map(option => option.id),
title: writingTitle ?? '',
imageUrl: imageUrl ?? '',
content: writingContent ?? '',
Expand Down Expand Up @@ -169,10 +173,6 @@ export default function PostForm({ data, mutate, isError, error }: PostFormProps
return `${timeMessage.join(' ')} 후에 마감됩니다.`;
};

const { selectedOptionList, handleOptionAdd, handleOptionDelete } = useMultiSelect(
categoryIds ?? [],
CATEGORY_COUNT_LIMIT
);
return (
<>
<S.HeaderWrapper>
Expand Down

0 comments on commit 53f6bd6

Please sign in to comment.