|
|
@@ -5,7 +5,7 @@ import {
|
|
|
Modal, ModalHeader, ModalBody, ModalFooter,
|
|
|
} from 'reactstrap';
|
|
|
|
|
|
-import { withTranslation } from 'react-i18next';
|
|
|
+import { useTranslation } from 'react-i18next';
|
|
|
|
|
|
import { usePutBackPageModal } from '~/stores/modal';
|
|
|
import { apiPost } from '~/client/util/apiv1-client';
|
|
|
@@ -13,13 +13,12 @@ import { apiPost } from '~/client/util/apiv1-client';
|
|
|
import ApiErrorMessageList from './PageManagement/ApiErrorMessageList';
|
|
|
|
|
|
const PutBackPageModal = (props) => {
|
|
|
- const {
|
|
|
- t,
|
|
|
- } = props;
|
|
|
+ const { t } = useTranslation();
|
|
|
|
|
|
const { data: pageDataToRevert, close: closePutBackPageModal } = usePutBackPageModal();
|
|
|
const { isOpened, page } = pageDataToRevert;
|
|
|
const { pageId, path } = page;
|
|
|
+ const onPutBacked = pageDataToRevert.opts?.onPutBacked;
|
|
|
|
|
|
const [errs, setErrs] = useState(null);
|
|
|
|
|
|
@@ -42,8 +41,11 @@ const PutBackPageModal = (props) => {
|
|
|
recursively,
|
|
|
});
|
|
|
|
|
|
- const putbackPagePath = response.page.path;
|
|
|
- window.location.href = encodeURI(putbackPagePath);
|
|
|
+ const putbackPagePath = encodeURI(response.page.path);
|
|
|
+ if (onPutBacked != null) {
|
|
|
+ onPutBacked(putbackPagePath);
|
|
|
+ }
|
|
|
+ closePutBackPageModal();
|
|
|
}
|
|
|
catch (err) {
|
|
|
setErrs(err);
|
|
|
@@ -88,9 +90,4 @@ const PutBackPageModal = (props) => {
|
|
|
|
|
|
};
|
|
|
|
|
|
-PutBackPageModal.propTypes = {
|
|
|
- t: PropTypes.func.isRequired, // i18next
|
|
|
-};
|
|
|
-
|
|
|
-
|
|
|
-export default withTranslation()(PutBackPageModal);
|
|
|
+export default PutBackPageModal;
|