Explorar o código

返回已经复制的句子数量

visuddhinanda hai 1 ano
pai
achega
9f1f872f9f

+ 4 - 5
dashboard-v4/dashboard/src/components/channel/ChannelSentDiff.tsx

@@ -31,7 +31,7 @@ interface IWidget {
   sentences?: string[];
   sentences?: string[];
   important?: boolean;
   important?: boolean;
   goPrev?: Function;
   goPrev?: Function;
-  onSubmit?: Function;
+  onSubmit?: (total: number) => void;
 }
 }
 const ChannelSentDiffWidget = ({
 const ChannelSentDiffWidget = ({
   srcChannel,
   srcChannel,
@@ -199,18 +199,17 @@ const ChannelSentDiffWidget = ({
               copy: true,
               copy: true,
               fork_from: srcChannel.id,
               fork_from: srcChannel.id,
             };
             };
-            console.debug("fork post", url, postData);
+            console.info("fork post api request", url, postData);
             post<ISentenceNewRequest, ISentenceListResponse>(url, postData)
             post<ISentenceNewRequest, ISentenceListResponse>(url, postData)
               .then((json) => {
               .then((json) => {
+                console.info("fork api response", json);
                 if (json.ok) {
                 if (json.ok) {
                   //发布数据
                   //发布数据
                   const newData: ISentence[] = json.data.rows.map((item) =>
                   const newData: ISentence[] = json.data.rows.map((item) =>
                     toISentence(item)
                     toISentence(item)
                   );
                   );
                   store.dispatch(accept(newData));
                   store.dispatch(accept(newData));
-                  if (typeof onSubmit !== "undefined") {
-                    onSubmit();
-                  }
+                  onSubmit && onSubmit(json.data.count);
                 } else {
                 } else {
                   message.error(json.message);
                   message.error(json.message);
                 }
                 }