Browse Source

add deleted_at

visuddhinanda 2 years ago
parent
commit
2d7ea0dd21
1 changed files with 20 additions and 18 deletions
  1. 20 18
      dashboard/src/components/anthology/EditableTocTree.tsx

+ 20 - 18
dashboard/src/components/anthology/EditableTocTree.tsx

@@ -10,6 +10,7 @@ import {
   IArticleDataResponse,
   IArticleMapAddResponse,
   IArticleMapListResponse,
+  IArticleMapRequest,
   IArticleMapUpdateRequest,
   IArticleResponse,
 } from "../api/Article";
@@ -45,25 +46,26 @@ const EditableTocTreeWidget = ({
     if (typeof data === "undefined") {
       return;
     }
-    put<IArticleMapUpdateRequest, IArticleMapAddResponse>(
-      `/v2/article-map/${anthologyId}`,
-      {
-        data: data.map((item) => {
-          let title = "";
-          if (typeof item.title === "string") {
-            title = item.title;
-          }
-          //TODO 整一个string title
-          return {
-            article_id: item.key,
-            level: item.level,
-            title: title,
-            children: item.children,
-          };
-        }),
-        operation: "anthology",
+    const url = `/v2/article-map/${anthologyId}`;
+    const newData: IArticleMapRequest[] = data.map((item) => {
+      let title = "";
+      if (typeof item.title === "string") {
+        title = item.title;
       }
-    )
+      //TODO 整一个string title
+      return {
+        article_id: item.key,
+        level: item.level,
+        title: title,
+        children: item.children,
+        deleted_at: item.deletedAt,
+      };
+    });
+
+    put<IArticleMapUpdateRequest, IArticleMapAddResponse>(url, {
+      data: newData,
+      operation: "anthology",
+    })
       .finally(() => {})
       .then((json) => {
         if (json.ok) {