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

+ 2 - 3
src/client/js/components/PageDuplicateModal.jsx

@@ -75,9 +75,8 @@ const PageDuplicateModal = (props) => {
       window.location.href = encodeURI(`${result}?duplicated=${path}`);
     }
     catch (err) {
-      console.log(err);
-      setErrorCode(err.code);
-      setErrorMessage(err.message);
+      setErrorCode(err[0].code);
+      setErrorMessage(err[0].message);
     }
   }
 

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

@@ -192,9 +192,7 @@ module.exports = (crowi) => {
     const isExist = (await Page.count(req.body.path)) > 0;
     if (isExist) {
       res.code = 'page_exists';
-      return res.apiv3Err(new ErrorV3('Page exists'), 409);
-      // return res.apiv3Err('Page exists', 409);
-
+      return res.apiv3Err(new ErrorV3('This page is already exist.', 'already_exists'));
     }
 
     const createdPage = await Page.create(req.body.path, req.body.body, req.user);