Skip to content

Commit

Permalink
refactor: (#24) 불분명한 게시글 컴포넌트의 클릭핸들러 인자명 수정.
Browse files Browse the repository at this point in the history
- 수정전: optionId
- 수정후: newOptionId
  • Loading branch information
chsua committed Jul 15, 2023
1 parent ef1a7f8 commit a89a17e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions frontend/src/components/common/Post/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ interface PostProps {
export default function Post({ postInfo, isPreview }: PostProps) {
const { postId, category, title, writer, startTime, endTime, content, voteInfo } = postInfo;

const handleVoteClick = (optionId: number) => {
if (voteInfo.selectedOptionId === optionId) return;
const handleVoteClick = (newOptionId: number) => {
if (voteInfo.selectedOptionId === newOptionId) return;

if (voteInfo.selectedOptionId === 0) {
votePost(postId, optionId);
votePost(postId, newOptionId);
return;
}

changeVotedOption(postId, voteInfo.selectedOptionId, optionId);
changeVotedOption(postId, voteInfo.selectedOptionId, newOptionId);
};

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ interface WrittenVoteOptionListProps {
isPreview: boolean;
selectedOptionId: number;
voteOptionList: WrittenVoteOptionType[];
handleVoteClick: (optionId: number) => void;
handleVoteClick: (newOptionId: number) => void;
}

const NOT_VOTED = 0;
Expand Down

0 comments on commit a89a17e

Please sign in to comment.