zahmis 5 лет назад
Родитель
Сommit
c0c88abd51

+ 1 - 1
src/client/js/components/PageDuplicateModal.jsx

@@ -69,7 +69,7 @@ const PageDuplicateModal = (props) => {
     setErrs(null);
 
     try {
-      const res = await appContainer.apiPost('/pages/duplicate', { page_id: pageId, new_path: pageNameInput });
+      const res = await appContainer.apiv3Post('/pages/duplicate', { pageId, pageNameInput });
       const { page } = res;
       window.location.href = encodeURI(`${page.path}?duplicated=${path}`);
     }

+ 1 - 2
src/server/routes/apiv3/pages.js

@@ -389,8 +389,7 @@ module.exports = (crowi) => {
     // check page existence
     const isExist = (await Page.count({ path: req.body.path })) > 0;
     if (isExist) {
-      res.code = 'page_exists';
-      return res.apiv3Err(new ErrorV3('Page exists', 'already_exists'), 409);
+      return res.apiv3Err(new ErrorV3(`Page exists '${req.body.path})'`, 'already_exists'), 409);
     }
 
     const createdPage = await Page.create(req.body.path, req.body.body, req.user);