diff --git a/apps/admin-x-settings/src/admin-x-ds/global/modal/Modal.tsx b/apps/admin-x-settings/src/admin-x-ds/global/modal/Modal.tsx index 22cb64f3e7..1c17502c6e 100644 --- a/apps/admin-x-settings/src/admin-x-ds/global/modal/Modal.tsx +++ b/apps/admin-x-settings/src/admin-x-ds/global/modal/Modal.tsx @@ -28,6 +28,7 @@ export interface ModalProps { noPadding?: boolean; onOk?: () => void; onCancel?: () => void; + afterClose?: () => void; children?: React.ReactNode; backDrop?: boolean; backDropClick?: boolean; @@ -49,6 +50,7 @@ const Modal: React.FC = ({ onOk, okColor = 'black', onCancel, + afterClose, children, backDrop = true, backDropClick = true, @@ -66,7 +68,10 @@ const Modal: React.FC = ({ let buttons: ButtonProps[] = []; const removeModal = () => { - confirmIfDirty(dirty, () => modal.remove()); + confirmIfDirty(dirty, () => { + modal.remove(); + afterClose?.(); + }); }; if (!footer) { diff --git a/apps/admin-x-settings/src/admin-x-ds/global/modal/PreviewModal.tsx b/apps/admin-x-settings/src/admin-x-ds/global/modal/PreviewModal.tsx index e8db9ac696..604e4dfffe 100644 --- a/apps/admin-x-settings/src/admin-x-ds/global/modal/PreviewModal.tsx +++ b/apps/admin-x-settings/src/admin-x-ds/global/modal/PreviewModal.tsx @@ -36,6 +36,7 @@ export interface PreviewModalProps { onCancel?: () => void; onOk?: () => void; + afterClose?: () => void; onSelectURL?: (url: string) => void; onSelectDesktopView?: () => void; onSelectMobileView?: () => void; @@ -65,6 +66,7 @@ export const PreviewModalContent: React.FC = ({ onCancel, onOk, + afterClose, onSelectURL, onSelectDesktopView, onSelectMobileView @@ -155,7 +157,10 @@ export const PreviewModalContent: React.FC = ({ key: 'cancel-modal', label: cancelLabel, onClick: (onCancel ? onCancel : () => { - confirmIfDirty(dirty, () => modal.remove()); + confirmIfDirty(dirty, () => { + modal.remove(); + afterClose?.(); + }); }), disabled: buttonsDisabled }); @@ -172,6 +177,7 @@ export const PreviewModalContent: React.FC = ({ return (