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 { Link } from "react-router-dom";
|
||||
@@ -29,15 +29,7 @@ function updateBillCache(items) {
|
||||
});
|
||||
}
|
||||
|
||||
export function PayableExportButton({
|
||||
bodyshop,
|
||||
currentUser,
|
||||
billId,
|
||||
disabled,
|
||||
loadingCallback,
|
||||
setSelectedBills,
|
||||
refetch
|
||||
}) {
|
||||
export function PayableExportButton({ bodyshop, currentUser, billId, disabled, loadingCallback, setSelectedBills }) {
|
||||
const { t } = useTranslation();
|
||||
const [updateBill] = useMutation(UPDATE_BILLS);
|
||||
const [loading, setLoading] = useState(false);
|
||||
@@ -108,7 +100,7 @@ export function PayableExportButton({
|
||||
})
|
||||
})
|
||||
);
|
||||
if (!(bodyshop.accountingconfig && bodyshop.accountingconfig.qbo)) {
|
||||
if (!bodyshop.accountingconfig?.qbo) {
|
||||
//QBO Logs are handled server side.
|
||||
await insertExportLog({
|
||||
variables: {
|
||||
@@ -126,7 +118,7 @@ export function PayableExportButton({
|
||||
}
|
||||
}
|
||||
if (successfulTransactions.length > 0) {
|
||||
if (!(bodyshop.accountingconfig && bodyshop.accountingconfig.qbo)) {
|
||||
if (!bodyshop.accountingconfig?.qbo) {
|
||||
//QBO Logs are handled server side.
|
||||
await insertExportLog({
|
||||
variables: {
|
||||
@@ -142,9 +134,7 @@ export function PayableExportButton({
|
||||
});
|
||||
const billUpdateResponse = await updateBill({
|
||||
variables: {
|
||||
billIdList: successfulTransactions.map(
|
||||
(st) => st[bodyshop.accountingconfig && bodyshop.accountingconfig.qbo ? "billid" : "id"]
|
||||
),
|
||||
billIdList: successfulTransactions.map((st) => st[bodyshop.accountingconfig?.qbo ? "billid" : "id"]),
|
||||
bill: {
|
||||
exported: true,
|
||||
exported_at: new Date()
|
||||
@@ -166,18 +156,14 @@ export function PayableExportButton({
|
||||
});
|
||||
}
|
||||
}
|
||||
if (bodyshop.accountingconfig && bodyshop.accountingconfig.qbo && successfulTransactions.length > 0) {
|
||||
if (bodyshop.accountingconfig?.qbo && successfulTransactions.length > 0) {
|
||||
notification.open({
|
||||
type: "success",
|
||||
key: "billsuccessexport",
|
||||
message: t("bills.successes.exported")
|
||||
});
|
||||
updateBillCache([
|
||||
...new Set(
|
||||
successfulTransactions.map(
|
||||
(st) => st[bodyshop.accountingconfig && bodyshop.accountingconfig.qbo ? "billid" : "id"]
|
||||
)
|
||||
)
|
||||
...new Set(successfulTransactions.map((st) => st[bodyshop.accountingconfig?.qbo ? "billid" : "id"]))
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user