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) => {
|
const handleSubmit = async (event) => {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
||||||
|
if (
|
||||||
|
commentRef.current.value === "" &&
|
||||||
|
linkRef.current.value === ""
|
||||||
|
) {
|
||||||
|
setErrorMessage("Please enter a comment or link.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
setPublishCommentOptions((prevPublishCommentOptions) => ({
|
setPublishCommentOptions((prevPublishCommentOptions) => ({
|
||||||
...prevPublishCommentOptions,
|
...prevPublishCommentOptions,
|
||||||
author: {
|
author: {
|
||||||
@@ -152,7 +160,7 @@ const ReplyModal = ({ isOpen, closeModal }) => {
|
|||||||
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (publishCommentOptions.content && triggerPublishComment) {
|
if (publishCommentOptions && triggerPublishComment) {
|
||||||
(async () => {
|
(async () => {
|
||||||
await publishComment();
|
await publishComment();
|
||||||
resetFields();
|
resetFields();
|
||||||
|
|||||||
@@ -278,7 +278,7 @@ const Board = () => {
|
|||||||
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (publishCommentOptions.subject && triggerPublishComment) {
|
if (publishCommentOptions && triggerPublishComment) {
|
||||||
(async () => {
|
(async () => {
|
||||||
await publishComment();
|
await publishComment();
|
||||||
resetFields();
|
resetFields();
|
||||||
|
|||||||
@@ -203,7 +203,7 @@ const Catalog = () => {
|
|||||||
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (publishCommentOptions.subject && triggerPublishComment) {
|
if (publishCommentOptions && triggerPublishComment) {
|
||||||
(async () => {
|
(async () => {
|
||||||
await publishComment();
|
await publishComment();
|
||||||
resetFields();
|
resetFields();
|
||||||
|
|||||||
@@ -210,6 +210,15 @@ const Thread = () => {
|
|||||||
const handleSubmit = async (event) => {
|
const handleSubmit = async (event) => {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
||||||
|
if (
|
||||||
|
commentRef.current.value === "" &&
|
||||||
|
linkRef.current.value === ""
|
||||||
|
) {
|
||||||
|
setErrorMessage("Please enter a comment or link.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
setPublishCommentOptions((prevPublishCommentOptions) => ({
|
setPublishCommentOptions((prevPublishCommentOptions) => ({
|
||||||
...prevPublishCommentOptions,
|
...prevPublishCommentOptions,
|
||||||
author: {
|
author: {
|
||||||
@@ -225,7 +234,7 @@ const Thread = () => {
|
|||||||
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (publishCommentOptions.content && triggerPublishComment) {
|
if (publishCommentOptions && triggerPublishComment) {
|
||||||
(async () => {
|
(async () => {
|
||||||
await publishComment();
|
await publishComment();
|
||||||
resetFields();
|
resetFields();
|
||||||
|
|||||||
Reference in New Issue
Block a user