mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
fix posting field checks
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -278,7 +278,7 @@ const Board = () => {
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
if (publishCommentOptions.subject && triggerPublishComment) {
|
||||
if (publishCommentOptions && triggerPublishComment) {
|
||||
(async () => {
|
||||
await publishComment();
|
||||
resetFields();
|
||||
|
||||
@@ -203,7 +203,7 @@ const Catalog = () => {
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
if (publishCommentOptions.subject && triggerPublishComment) {
|
||||
if (publishCommentOptions && triggerPublishComment) {
|
||||
(async () => {
|
||||
await publishComment();
|
||||
resetFields();
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user