itizawa 5 rokov pred
rodič
commit
406050c21f

+ 4 - 4
src/client/js/components/EmptyTrashModal.jsx

@@ -16,17 +16,17 @@ const EmptyTrashModal = (props) => {
     t, isOpen, onClose, appContainer,
     t, isOpen, onClose, appContainer,
   } = props;
   } = props;
 
 
-  const [errors, setErrors] = useState(null);
+  const [errForDisplay, setErrForDisplay] = useState(null);
 
 
   async function emptyTrash() {
   async function emptyTrash() {
-    setErrors(null);
+    setErrForDisplay(null);
 
 
     try {
     try {
       await appContainer.apiv3Delete('/pages/empty-trash');
       await appContainer.apiv3Delete('/pages/empty-trash');
       window.location.reload();
       window.location.reload();
     }
     }
     catch (err) {
     catch (err) {
-      setErrors(err);
+      setErrForDisplay(err);
     }
     }
   }
   }
 
 
@@ -43,7 +43,7 @@ const EmptyTrashModal = (props) => {
         { t('modal_empty.notice')}
         { t('modal_empty.notice')}
       </ModalBody>
       </ModalBody>
       <ModalFooter>
       <ModalFooter>
-        <ApiErrorMessage errors={errors} />
+        <ApiErrorMessage errForDisplay={errForDisplay} />
         <button type="button" className="btn btn-danger" onClick={emptyButtonHandler}>
         <button type="button" className="btn btn-danger" onClick={emptyButtonHandler}>
           <i className="icon-trash mr-2" aria-hidden="true"></i> Empty
           <i className="icon-trash mr-2" aria-hidden="true"></i> Empty
         </button>
         </button>

+ 4 - 4
src/client/js/components/PageDeleteModal.jsx

@@ -33,7 +33,7 @@ const PageDeleteModal = (props) => {
   const [isDeleteCompletely, setIsDeleteCompletely] = useState(isDeleteCompletelyModal && isAbleToDeleteCompletely);
   const [isDeleteCompletely, setIsDeleteCompletely] = useState(isDeleteCompletelyModal && isAbleToDeleteCompletely);
   const deleteMode = isDeleteCompletely ? 'completely' : 'temporary';
   const deleteMode = isDeleteCompletely ? 'completely' : 'temporary';
 
 
-  const [errors, setErrors] = useState(null);
+  const [errForDisplay, setErrForDisplay] = useState(null);
 
 
   function changeIsDeleteRecursivelyHandler() {
   function changeIsDeleteRecursivelyHandler() {
     setIsDeleteRecursively(!isDeleteRecursively);
     setIsDeleteRecursively(!isDeleteRecursively);
@@ -47,7 +47,7 @@ const PageDeleteModal = (props) => {
   }
   }
 
 
   async function deletePage() {
   async function deletePage() {
-    setErrors(null);
+    setErrForDisplay(null);
 
 
     try {
     try {
       const response = await pageContainer.deletePage(isDeleteRecursively, isDeleteCompletely);
       const response = await pageContainer.deletePage(isDeleteRecursively, isDeleteCompletely);
@@ -55,7 +55,7 @@ const PageDeleteModal = (props) => {
       window.location.href = encodeURI(trashPagePath);
       window.location.href = encodeURI(trashPagePath);
     }
     }
     catch (err) {
     catch (err) {
-      setErrors(err);
+      setErrForDisplay(err);
     }
     }
   }
   }
 
 
@@ -122,7 +122,7 @@ const PageDeleteModal = (props) => {
         {!isDeleteCompletelyModal && renderDeleteCompletelyForm()}
         {!isDeleteCompletelyModal && renderDeleteCompletelyForm()}
       </ModalBody>
       </ModalBody>
       <ModalFooter>
       <ModalFooter>
-        <ApiErrorMessage errors={errors} />
+        <ApiErrorMessage errForDisplay={errForDisplay} />
         <button type="button" className={`btn btn-${deleteIconAndKey[deleteMode].color}`} onClick={deleteButtonHandler}>
         <button type="button" className={`btn btn-${deleteIconAndKey[deleteMode].color}`} onClick={deleteButtonHandler}>
           <i className={`icon-${deleteIconAndKey[deleteMode].icon}`} aria-hidden="true"></i>
           <i className={`icon-${deleteIconAndKey[deleteMode].icon}`} aria-hidden="true"></i>
           { t(`modal_delete.delete_${deleteIconAndKey[deleteMode].translationKey}`) }
           { t(`modal_delete.delete_${deleteIconAndKey[deleteMode].translationKey}`) }

+ 4 - 5
src/client/js/components/PageDuplicateModal.jsx

@@ -24,8 +24,7 @@ const PageDuplicateModal = (props) => {
 
 
   const [pageNameInput, setPageNameInput] = useState(path);
   const [pageNameInput, setPageNameInput] = useState(path);
 
 
-  // errors:array
-  const [errors, setErrors] = useState(null);
+  const [errForDisplay, setErrForDisplay] = useState(null);
 
 
   const [subordinatedPaths, setSubordinatedPaths] = useState([]);
   const [subordinatedPaths, setSubordinatedPaths] = useState([]);
   const [getSubordinatedError, setGetSuborinatedError] = useState(null);
   const [getSubordinatedError, setGetSuborinatedError] = useState(null);
@@ -69,7 +68,7 @@ const PageDuplicateModal = (props) => {
   }, [props.isOpen, getSubordinatedList]);
   }, [props.isOpen, getSubordinatedList]);
 
 
   async function duplicate() {
   async function duplicate() {
-    setErrors(null);
+    setErrForDisplay(null);
 
 
     try {
     try {
       const res = await appContainer.apiPost('/pages.duplicate', { page_id: pageId, new_path: pageNameInput });
       const res = await appContainer.apiPost('/pages.duplicate', { page_id: pageId, new_path: pageNameInput });
@@ -77,7 +76,7 @@ const PageDuplicateModal = (props) => {
       window.location.href = encodeURI(`${page.path}?duplicated=${path}`);
       window.location.href = encodeURI(`${page.path}?duplicated=${path}`);
     }
     }
     catch (err) {
     catch (err) {
-      setErrors(err);
+      setErrForDisplay(err);
     }
     }
   }
   }
 
 
@@ -143,7 +142,7 @@ const PageDuplicateModal = (props) => {
         </div>
         </div>
       </ModalBody>
       </ModalBody>
       <ModalFooter>
       <ModalFooter>
-        <ApiErrorMessage errors={errors} targetPath={pageNameInput} />
+        <ApiErrorMessage errForDisplay={errForDisplay} targetPath={pageNameInput} />
         <button type="button" className="btn btn-primary" onClick={duplicate}>Duplicate page</button>
         <button type="button" className="btn btn-primary" onClick={duplicate}>Duplicate page</button>
       </ModalFooter>
       </ModalFooter>
     </Modal>
     </Modal>

+ 4 - 4
src/client/js/components/PageRenameModal.jsx

@@ -24,7 +24,7 @@ const PageRenameModal = (props) => {
 
 
   const [pageNameInput, setPageNameInput] = useState(path);
   const [pageNameInput, setPageNameInput] = useState(path);
 
 
-  const [errors, setErrors] = useState(null);
+  const [errForDisplay, setErrForDisplay] = useState(null);
 
 
   const [isRenameRecursively, SetIsRenameRecursively] = useState(true);
   const [isRenameRecursively, SetIsRenameRecursively] = useState(true);
   const [isRenameRedirect, SetIsRenameRedirect] = useState(false);
   const [isRenameRedirect, SetIsRenameRedirect] = useState(false);
@@ -51,7 +51,7 @@ const PageRenameModal = (props) => {
   }
   }
 
 
   async function rename() {
   async function rename() {
-    setErrors(null);
+    setErrForDisplay(null);
 
 
     try {
     try {
       const response = await pageContainer.rename(
       const response = await pageContainer.rename(
@@ -71,7 +71,7 @@ const PageRenameModal = (props) => {
       window.location.href = `${url.pathname}${url.search}`;
       window.location.href = `${url.pathname}${url.search}`;
     }
     }
     catch (err) {
     catch (err) {
-      setErrors(err);
+      setErrForDisplay(err);
     }
     }
   }
   }
 
 
@@ -148,7 +148,7 @@ const PageRenameModal = (props) => {
         </div>
         </div>
       </ModalBody>
       </ModalBody>
       <ModalFooter>
       <ModalFooter>
-        <ApiErrorMessage errors={errors} targetPath={pageNameInput} />
+        <ApiErrorMessage errForDisplay={errForDisplay} targetPath={pageNameInput} />
         <button type="button" className="btn btn-primary" onClick={rename}>Rename</button>
         <button type="button" className="btn btn-primary" onClick={rename}>Rename</button>
       </ModalFooter>
       </ModalFooter>
     </Modal>
     </Modal>

+ 4 - 4
src/client/js/components/PutbackPageModal.jsx

@@ -18,7 +18,7 @@ const PutBackPageModal = (props) => {
     t, isOpen, onClose, pageContainer, path,
     t, isOpen, onClose, pageContainer, path,
   } = props;
   } = props;
 
 
-  const [errors, setErrors] = useState(null);
+  const [errForDisplay, setErrForDisplay] = useState(null);
 
 
   const [isPutbackRecursively, setIsPutbackRecursively] = useState(true);
   const [isPutbackRecursively, setIsPutbackRecursively] = useState(true);
 
 
@@ -27,7 +27,7 @@ const PutBackPageModal = (props) => {
   }
   }
 
 
   async function putbackPage() {
   async function putbackPage() {
-    setErrors(null);
+    setErrForDisplay(null);
 
 
     try {
     try {
       const response = await pageContainer.revertRemove(isPutbackRecursively);
       const response = await pageContainer.revertRemove(isPutbackRecursively);
@@ -35,7 +35,7 @@ const PutBackPageModal = (props) => {
       window.location.href = encodeURI(putbackPagePath);
       window.location.href = encodeURI(putbackPagePath);
     }
     }
     catch (err) {
     catch (err) {
-      setErrors(err);
+      setErrForDisplay(err);
     }
     }
   }
   }
 
 
@@ -70,7 +70,7 @@ const PutBackPageModal = (props) => {
         </div>
         </div>
       </ModalBody>
       </ModalBody>
       <ModalFooter>
       <ModalFooter>
-        <ApiErrorMessage errors={errors} />
+        <ApiErrorMessage errForDisplay={errForDisplay} />
         <button type="button" className="btn btn-info" onClick={putbackPageButtonHandler}>
         <button type="button" className="btn btn-info" onClick={putbackPageButtonHandler}>
           <i className="icon-action-undo mr-2" aria-hidden="true"></i> { t('Put Back') }
           <i className="icon-action-undo mr-2" aria-hidden="true"></i> { t('Put Back') }
         </button>
         </button>