visuddhinanda 2 éve
szülő
commit
b3756d5dcb

+ 6 - 2
dashboard/src/components/discussion/DiscussionCreate.tsx

@@ -43,6 +43,7 @@ interface IWidget {
   resId?: string;
   resId?: string;
   resType?: string;
   resType?: string;
   parent?: string;
   parent?: string;
+  topicId?: string;
   type?: TDiscussionType;
   type?: TDiscussionType;
   topic?: IComment;
   topic?: IComment;
   contentType?: TContentType;
   contentType?: TContentType;
@@ -54,6 +55,7 @@ const DiscussionCreateWidget = ({
   resType,
   resType,
   contentType = "html",
   contentType = "html",
   parent,
   parent,
+  topicId,
   topic,
   topic,
   type = "discussion",
   type = "discussion",
   onCreated,
   onCreated,
@@ -89,7 +91,7 @@ const DiscussionCreateWidget = ({
                     tpl_id: topic.tplId,
                     tpl_id: topic.tplId,
                     content: topic.content,
                     content: topic.content,
                     content_type: "markdown",
                     content_type: "markdown",
-                    type: type,
+                    type: topic.type,
                   };
                   };
                   console.log("create topic", topicData);
                   console.log("create topic", topicData);
                   const newTopic = await post<
                   const newTopic = await post<
@@ -109,14 +111,16 @@ const DiscussionCreateWidget = ({
                 }
                 }
               }
               }
               console.log("parent", currParent);
               console.log("parent", currParent);
+
               post<ICommentRequest, ICommentResponse>(`/v2/discussion`, {
               post<ICommentRequest, ICommentResponse>(`/v2/discussion`, {
                 res_id: resId,
                 res_id: resId,
                 res_type: resType,
                 res_type: resType,
                 parent: newParent ? newParent : currParent,
                 parent: newParent ? newParent : currParent,
+                topicId: topicId,
                 title: values.title,
                 title: values.title,
                 content: values.content,
                 content: values.content,
                 content_type: contentType,
                 content_type: contentType,
-                type: type,
+                type: topic ? topic.type : type,
               })
               })
                 .then((json) => {
                 .then((json) => {
                   console.log("new discussion", json);
                   console.log("new discussion", json);