diff options
author | Ivan Chen <ivan@tagg.id> | 2021-01-27 17:03:50 -0500 |
---|---|---|
committer | Ivan Chen <ivan@tagg.id> | 2021-01-27 17:03:50 -0500 |
commit | ff3d1e51a1f9d175cfe460e6a16497a6226f450f (patch) | |
tree | 04af9b8cfced9d8cc334a2c8635275b9d5f89a79 /src/components | |
parent | 01b31b3f54ed58093df8e3f98e95268c0ace5f8a (diff) |
fixed bug to submit with empty string
Diffstat (limited to 'src/components')
-rw-r--r-- | src/components/comments/AddComment.tsx | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/components/comments/AddComment.tsx b/src/components/comments/AddComment.tsx index 46086e81..44f49748 100644 --- a/src/components/comments/AddComment.tsx +++ b/src/components/comments/AddComment.tsx @@ -40,8 +40,12 @@ const AddComment: React.FC<AddCommentProps> = ({ const {avatar} = useSelector((state: RootState) => state.user); const addComment = async () => { + const trimmed = comment.trim(); + if (trimmed === '') { + return; + } const postedComment = await postComment( - comment.trim(), + trimmed, objectId, isCommentInFocus, ); |