From 3c4902f71f7631308b43b206190d9fd69515c28f Mon Sep 17 00:00:00 2001 From: swtmply Date: Fri, 26 May 2023 00:48:28 +0800 Subject: [PATCH] IO-2298 removed import destructure and added context reload --- .../payment-modal/payment-modal.container.jsx | 17 +++------------ .../payment-reexport-button.component.jsx | 21 +++++++++++++++++-- 2 files changed, 22 insertions(+), 16 deletions(-) diff --git a/client/src/components/payment-modal/payment-modal.container.jsx b/client/src/components/payment-modal/payment-modal.container.jsx index c9263769a..28c47c30c 100644 --- a/client/src/components/payment-modal/payment-modal.container.jsx +++ b/client/src/components/payment-modal/payment-modal.container.jsx @@ -19,7 +19,7 @@ import { import { GenerateDocument } from "../../utils/RenderTemplate"; import { TemplateList } from "../../utils/TemplateConstants"; import PaymentForm from "../payment-form/payment-form.component"; -import { PaymentExportButton } from "../payment-export-button/payment-export-button.component"; +import PaymentExportButton from "../payment-export-button/payment-export-button.component"; import PaymentReexportButton from "../payment-reexport-button/payment-reexport-button.component"; const mapStateToProps = createStructuredSelector({ @@ -179,23 +179,12 @@ function PaymentModalContainer({ } > - { - toggleModalVisible(); - - return actions.refetch; - }} - /> + { - toggleModalVisible(); - - return actions.refetch; - }} + refetch={actions.refetch} />
{ +const mapDispatchToProps = (dispatch) => ({ + setPaymentContext: (context) => + dispatch(setModalContext({ context: context, modal: "payment" })), +}); + +const PaymentReexportButton = ({ payment, refetch, setPaymentContext }) => { const { t } = useTranslation(); const [updatePayment, { loading }] = useMutation(UPDATE_PAYMENT); @@ -26,6 +33,16 @@ const PaymentReexportButton = ({ payment, refetch }) => { }); if (refetch) refetch(); + + setPaymentContext({ + actions: { + refetch, + }, + context: { + ...payment, + exportedat: null, + }, + }); } else { notification["error"]({ message: t("payments.errors.exporting", { @@ -46,4 +63,4 @@ const PaymentReexportButton = ({ payment, refetch }) => { ); }; -export default PaymentReexportButton; +export default connect(null, mapDispatchToProps)(PaymentReexportButton);