IO-2727 Payment Re-export/Export button

Send data back to page

Signed-off-by: Allan Carr <allan.carr@thinkimex.com>
This commit is contained in:
Allan Carr
2024-03-27 12:14:47 -07:00
parent 09e505399c
commit 1fa83d124d
2 changed files with 22 additions and 20 deletions

View File

@@ -1,10 +1,10 @@
import React from "react";
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 { Button, notification } from "antd";
import React from "react";
import { useTranslation } from "react-i18next";
import { connect } from "react-redux";
import { UPDATE_PAYMENT } from "../../graphql/payments.queries";
import { setModalContext } from "../../redux/modals/modals.actions";
const mapDispatchToProps = (dispatch) => ({
setPaymentContext: (context) =>
@@ -24,16 +24,12 @@ const PaymentReexportButton = ({ payment, refetch, setPaymentContext }) => {
},
},
});
if (!!!paymentUpdateResponse.errors) {
notification.open({
type: "success",
key: "paymentsuccessexport",
message: t("payments.successes.markreexported"),
});
if (refetch) refetch();
setPaymentContext({
actions: {
refetch,
@@ -43,6 +39,11 @@ const PaymentReexportButton = ({ payment, refetch, setPaymentContext }) => {
exportedat: null,
},
});
if (refetch)
refetch(
paymentUpdateResponse &&
paymentUpdateResponse.data.update_payments.returning[0]
);
} else {
notification["error"]({
message: t("payments.errors.exporting", {