Skip to content

Commit

Permalink
message
Browse files Browse the repository at this point in the history
  • Loading branch information
EvgenyNikitinEvgeny committed Jul 22, 2023
1 parent d2e3b7c commit 72cae95
Showing 1 changed file with 31 additions and 1 deletion.
32 changes: 31 additions & 1 deletion src/components/NewCommentForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,37 @@ export const NewCommentForm: React.FC<Props> = ({
comment: !comment,
});

if (!name.trim() || !email.trim() || !comment.trim()) {
if (!name || !email || !comment) {
return;
}

if (!name.trim()) {
setErrorForm({
name: true,
email: false,
comment: false,
});

return;
}

if (!email.trim()) {
setErrorForm({
name: false,
email: true,
comment: false,
});

return;
}

if (!comment.trim()) {
setErrorForm({
name: false,
email: false,
comment: true,
});

return;
}

Expand Down

0 comments on commit 72cae95

Please sign in to comment.