Lint all the things
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { useMutation } from "@apollo/client";
|
||||
import { Button } from "antd";
|
||||
import axios from "axios";
|
||||
import React, { useState } from "react";
|
||||
import { useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { connect } from "react-redux";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
@@ -35,8 +35,7 @@ export function PaymentExportButton({
|
||||
paymentId,
|
||||
disabled,
|
||||
loadingCallback,
|
||||
setSelectedPayments,
|
||||
refetch
|
||||
setSelectedPayments
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
const [updatePayment] = useMutation(UPDATE_PAYMENTS);
|
||||
@@ -49,7 +48,7 @@ export function PaymentExportButton({
|
||||
setLoading(true);
|
||||
//Check if it's a QBO Setup.
|
||||
let PartnerResponse;
|
||||
if (bodyshop.accountingconfig && bodyshop.accountingconfig.qbo) {
|
||||
if (bodyshop.accountingconfig?.qbo) {
|
||||
PartnerResponse = await axios.post(`/qbo/payments`, {
|
||||
payments: [paymentId],
|
||||
elgen: true
|
||||
@@ -108,7 +107,7 @@ export function PaymentExportButton({
|
||||
})
|
||||
})
|
||||
);
|
||||
if (!(bodyshop.accountingconfig && bodyshop.accountingconfig.qbo)) {
|
||||
if (!bodyshop.accountingconfig?.qbo) {
|
||||
//QBO Logs are handled server side.
|
||||
await insertExportLog({
|
||||
variables: {
|
||||
@@ -125,7 +124,7 @@ export function PaymentExportButton({
|
||||
});
|
||||
}
|
||||
} else {
|
||||
if (!(bodyshop.accountingconfig && bodyshop.accountingconfig.qbo)) {
|
||||
if (!bodyshop.accountingconfig?.qbo) {
|
||||
//QBO Logs are handled server side.
|
||||
await insertExportLog({
|
||||
variables: {
|
||||
@@ -142,9 +141,7 @@ export function PaymentExportButton({
|
||||
|
||||
const paymentUpdateResponse = await updatePayment({
|
||||
variables: {
|
||||
paymentIdList: successfulTransactions.map(
|
||||
(st) => st[bodyshop.accountingconfig && bodyshop.accountingconfig.qbo ? "paymentid" : "id"]
|
||||
),
|
||||
paymentIdList: successfulTransactions.map((st) => st[bodyshop.accountingconfig?.qbo ? "paymentid" : "id"]),
|
||||
payment: {
|
||||
exportedat: new Date()
|
||||
}
|
||||
@@ -172,18 +169,14 @@ export function PaymentExportButton({
|
||||
});
|
||||
}
|
||||
}
|
||||
if (bodyshop.accountingconfig && bodyshop.accountingconfig.qbo && successfulTransactions.length > 0) {
|
||||
if (bodyshop?.accountingconfig?.qbo && successfulTransactions.length > 0) {
|
||||
notification.open({
|
||||
type: "success",
|
||||
key: "paymentsuccessexport",
|
||||
message: t("payments.successes.exported")
|
||||
});
|
||||
updatePaymentCache([
|
||||
...new Set(
|
||||
successfulTransactions.map(
|
||||
(st) => st[bodyshop.accountingconfig && bodyshop.accountingconfig.qbo ? "paymentid" : "id"]
|
||||
)
|
||||
)
|
||||
...new Set(successfulTransactions.map((st) => st[bodyshop.accountingconfig?.qbo ? "paymentid" : "id"]))
|
||||
]);
|
||||
}
|
||||
if (loadingCallback) loadingCallback(false);
|
||||
|
||||
Reference in New Issue
Block a user