fix posting field checks

This commit is contained in:
Tom
2023-05-12 21:32:33 +02:00
parent b8db711648
commit 812f04b557
4 changed files with 21 additions and 4 deletions
+10 -1
View File
@@ -210,6 +210,15 @@ const Thread = () => {
const handleSubmit = async (event) => {
event.preventDefault();
if (
commentRef.current.value === "" &&
linkRef.current.value === ""
) {
setErrorMessage("Please enter a comment or link.");
return;
}
setPublishCommentOptions((prevPublishCommentOptions) => ({
...prevPublishCommentOptions,
author: {
@@ -225,7 +234,7 @@ const Thread = () => {
useEffect(() => {
if (publishCommentOptions.content && triggerPublishComment) {
if (publishCommentOptions && triggerPublishComment) {
(async () => {
await publishComment();
resetFields();