IO-2298 removed import destructure and added context reload
This commit is contained in:
@@ -3,8 +3,15 @@ import { Button, notification } from "antd";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { UPDATE_PAYMENT } from "../../graphql/payments.queries";
|
||||
import { useMutation } from "@apollo/client";
|
||||
import { setModalContext } from "../../redux/modals/modals.actions";
|
||||
import { connect } from "react-redux";
|
||||
|
||||
const PaymentReexportButton = ({ payment, 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);
|
||||
|
||||
Reference in New Issue
Block a user