From ff3d1e51a1f9d175cfe460e6a16497a6226f450f Mon Sep 17 00:00:00 2001
From: Ivan Chen <ivan@tagg.id>
Date: Wed, 27 Jan 2021 17:03:50 -0500
Subject: fixed bug to submit with empty string

---
 src/components/comments/AddComment.tsx | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

(limited to 'src/components/comments/AddComment.tsx')

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,
     );
-- 
cgit v1.2.3-70-g09d2

