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
+9 -1
View File
@@ -137,6 +137,14 @@ const ReplyModal = ({ isOpen, closeModal }) => {
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: {
@@ -152,7 +160,7 @@ const ReplyModal = ({ isOpen, closeModal }) => {
useEffect(() => {
if (publishCommentOptions.content && triggerPublishComment) {
if (publishCommentOptions && triggerPublishComment) {
(async () => {
await publishComment();
resetFields();
+1 -1
View File
@@ -278,7 +278,7 @@ const Board = () => {
useEffect(() => {
if (publishCommentOptions.subject && triggerPublishComment) {
if (publishCommentOptions && triggerPublishComment) {
(async () => {
await publishComment();
resetFields();
+1 -1
View File
@@ -203,7 +203,7 @@ const Catalog = () => {
useEffect(() => {
if (publishCommentOptions.subject && triggerPublishComment) {
if (publishCommentOptions && triggerPublishComment) {
(async () => {
await publishComment();
resetFields();
+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();