|
@@ -1,13 +1,14 @@
|
|
|
import React, { useState } from 'react';
|
|
import React, { useState } from 'react';
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
|
+import { useTranslation } from 'react-i18next';
|
|
|
import {
|
|
import {
|
|
|
Modal, ModalHeader, ModalBody, ModalFooter,
|
|
Modal, ModalHeader, ModalBody, ModalFooter,
|
|
|
} from 'reactstrap';
|
|
} from 'reactstrap';
|
|
|
|
|
|
|
|
-import { useTranslation } from 'react-i18next';
|
|
|
|
|
-
|
|
|
|
|
-import { usePutBackPageModal } from '~/stores/modal';
|
|
|
|
|
import { apiPost } from '~/client/util/apiv1-client';
|
|
import { apiPost } from '~/client/util/apiv1-client';
|
|
|
|
|
+import { PathAlreadyExistsError } from '~/server/models/errors';
|
|
|
|
|
+import { usePutBackPageModal } from '~/stores/modal';
|
|
|
|
|
|
|
|
import ApiErrorMessageList from './PageManagement/ApiErrorMessageList';
|
|
import ApiErrorMessageList from './PageManagement/ApiErrorMessageList';
|
|
|
|
|
|
|
@@ -20,6 +21,7 @@ const PutBackPageModal = () => {
|
|
|
const onPutBacked = pageDataToRevert.opts?.onPutBacked;
|
|
const onPutBacked = pageDataToRevert.opts?.onPutBacked;
|
|
|
|
|
|
|
|
const [errs, setErrs] = useState(null);
|
|
const [errs, setErrs] = useState(null);
|
|
|
|
|
+ const [targetPath, setTargetPath] = useState(null);
|
|
|
|
|
|
|
|
const [isPutbackRecursively, setIsPutbackRecursively] = useState(true);
|
|
const [isPutbackRecursively, setIsPutbackRecursively] = useState(true);
|
|
|
|
|
|
|
@@ -46,7 +48,8 @@ const PutBackPageModal = () => {
|
|
|
closePutBackPageModal();
|
|
closePutBackPageModal();
|
|
|
}
|
|
}
|
|
|
catch (err) {
|
|
catch (err) {
|
|
|
- setErrs(err);
|
|
|
|
|
|
|
+ setTargetPath(err.data);
|
|
|
|
|
+ setErrs([err]);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -78,7 +81,7 @@ const PutBackPageModal = () => {
|
|
|
</div>
|
|
</div>
|
|
|
</ModalBody>
|
|
</ModalBody>
|
|
|
<ModalFooter>
|
|
<ModalFooter>
|
|
|
- <ApiErrorMessageList errs={errs} />
|
|
|
|
|
|
|
+ <ApiErrorMessageList errs={errs} targetPath={targetPath} />
|
|
|
<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>
|