Skip to content

Commit

Permalink
Merge pull request #1068 from peer-42seoul/1065-106-d-tp-team-board-e…
Browse files Browse the repository at this point in the history
…mpty-comment-bug

[1.0.6 / D-TP] 팀 페이지 게시판 댓글 버그 수정
  • Loading branch information
yoouyeon authored Mar 3, 2024
2 parents bf1c963 + eb9f4fa commit a28d563
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
8 changes: 7 additions & 1 deletion src/components/board/CommentForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,17 @@ export const CommentForm = ({ postId, teamId }: ICommentFormProps) => {
e.preventDefault()
setIsLoading(true)
const formData = new FormData(e.currentTarget)
const content = formData.get('new-content') as string
if (!content) {
setIsLoading(false)
openToast({ severity: 'error', message: '댓글을 입력해주세요.' })
return
}
axiosWithAuth
.post('/api/v1/team/post/comment/', {
teamId: teamId,
postId: postId,
content: formData.get('new-content') as string,
content,
})
.then(() => {
setIsLoading(false)
Expand Down
7 changes: 6 additions & 1 deletion src/components/board/CommentList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,14 @@ const Comment = ({ comment, postId }: ICommentProps) => {
const handleEdit = (e: FormEvent<HTMLFormElement>) => {
e.preventDefault()
const formData = new FormData(e.currentTarget)
const content = formData.get('content') as string
if (!content) {
openToast({ severity: 'error', message: '댓글을 입력해주세요.' })
return
}
axiosWithAuth
.put(`/api/v1/team/post/comment/${comment.answerId}`, {
content: formData.get('content') as string,
content,
})
.then(() => {
openToast({ severity: 'success', message: '댓글을 수정했습니다.' })
Expand Down
2 changes: 1 addition & 1 deletion src/components/board/CommentPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ export const CommentItem = ({
</Stack>
</form>
) : (
<Box sx={{ paddingRight: '2.5rem' }}>
<Box sx={{ paddingRight: '2.5rem', wordBreak: 'break-all' }}>
<Typography variant={'Body2'}>{comment.content}</Typography>
<Typography variant={'Tag'} color={'text.assistive'}>
{dayjs(comment.createdAt).format('YYYY년 M월 D일 h:m A')}
Expand Down

0 comments on commit a28d563

Please sign in to comment.