Shun Miyazawa 4 лет назад
Родитель
Сommit
1b0b5fd09e
1 измененных файлов с 9 добавлено и 11 удалено
  1. 9 11
      packages/app/src/components/Sidebar/PageTree/Item.tsx

+ 9 - 11
packages/app/src/components/Sidebar/PageTree/Item.tsx

@@ -265,24 +265,22 @@ const Item: FC<ItemProps> = (props: ItemProps) => {
     const parentPath = pathUtils.addTrailingSlash(page.path as string);
     const parentPath = pathUtils.addTrailingSlash(page.path as string);
     const newPagePath = `${parentPath}${inputText}`;
     const newPagePath = `${parentPath}${inputText}`;
     const isCreatable = pagePathUtils.isCreatablePage(newPagePath);
     const isCreatable = pagePathUtils.isCreatablePage(newPagePath);
-    let initialBody = '';
+    let body = '';
 
 
     const isEnabledAttachTitleHeader = props.appContainer.getConfig().isEnabledAttachTitleHeader;
     const isEnabledAttachTitleHeader = props.appContainer.getConfig().isEnabledAttachTitleHeader;
     if (isEnabledAttachTitleHeader) {
     if (isEnabledAttachTitleHeader) {
-      initialBody = pathUtils.attachTitleHeader(newPagePath);
+      body = pathUtils.attachTitleHeader(newPagePath);
     }
     }
 
 
     if (isCreatable) {
     if (isCreatable) {
-      const body = {
-        path: newPagePath,
-        body: initialBody,
-        grant: page.grant,
-        grantUserGroupId: page.grantedGroup,
-        createFromPageTree: true,
-      };
-
       try {
       try {
-        await apiv3Post('/pages/', body);
+        await apiv3Post('/pages/', {
+          path: newPagePath,
+          body,
+          grant: page.grant,
+          grantUserGroupId: page.grantedGroup,
+          createFromPageTree: true,
+        });
         mutateChildren();
         mutateChildren();
         toastSuccess(t('successfully_saved_the_page'));
         toastSuccess(t('successfully_saved_the_page'));
       }
       }