diff --git a/src/components/NewCommentForm.tsx b/src/components/NewCommentForm.tsx index c3ff05b50..3945b5282 100644 --- a/src/components/NewCommentForm.tsx +++ b/src/components/NewCommentForm.tsx @@ -24,14 +24,14 @@ export const NewCommentForm: React.FC = ({ const anyErrorCheck = () => { const errors = []; - setErrorName(!name); - errors.push(!name); + setErrorName(!name.trim()); + errors.push(!name.trim()); - setErrorEmail(!email); - errors.push(!email); + setErrorEmail(!email.trim()); + errors.push(!email.trim()); - setErrorBody(!body); - errors.push(!body); + setErrorBody(!body.trim()); + errors.push(!body.trim()); return errors.some(e => e === true); }; @@ -49,9 +49,9 @@ export const NewCommentForm: React.FC = ({ commentClient .add({ postId: post.id, - name: name, - email: email, - body: body, + name: name.trim(), + email: email.trim(), + body: body.trim(), }) .then(() => { setBody(''); @@ -116,7 +116,7 @@ export const NewCommentForm: React.FC = ({