add alert subject field, fix post only subject

This commit is contained in:
Tom
2023-05-11 21:19:57 +02:00
parent 94e8546afd
commit 5334ac637a
2 changed files with 12 additions and 2 deletions
+6 -1
View File
@@ -257,6 +257,11 @@ const Board = () => {
const handleSubmit = async (event) => {
event.preventDefault();
if (subjectRef.current.value === "") {
setErrorMessage('Subject field is mandatory');
return;
}
setPublishCommentOptions((prevPublishCommentOptions) => ({
...prevPublishCommentOptions,
@@ -273,7 +278,7 @@ const Board = () => {
useEffect(() => {
if (publishCommentOptions.content && triggerPublishComment) {
if (publishCommentOptions.subject && triggerPublishComment) {
(async () => {
await publishComment();
resetFields();
+6 -1
View File
@@ -182,6 +182,11 @@ const Catalog = () => {
const handleSubmit = async (event) => {
event.preventDefault();
if (subjectRef.current.value === "") {
setErrorMessage('Subject field is mandatory');
return;
}
setPublishCommentOptions((prevPublishCommentOptions) => ({
...prevPublishCommentOptions,
@@ -198,7 +203,7 @@ const Catalog = () => {
useEffect(() => {
if (publishCommentOptions.content && triggerPublishComment) {
if (publishCommentOptions.subject && triggerPublishComment) {
(async () => {
await publishComment();
resetFields();