Lint all the things
This commit is contained in:
@@ -2,7 +2,7 @@ import { useMutation } from "@apollo/client";
|
||||
import { Button } from "antd";
|
||||
import axios from "axios";
|
||||
import _ from "lodash";
|
||||
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";
|
||||
@@ -30,15 +30,7 @@ function updateBillCache(items) {
|
||||
});
|
||||
}
|
||||
|
||||
export function PayableExportAll({
|
||||
bodyshop,
|
||||
currentUser,
|
||||
billids,
|
||||
disabled,
|
||||
loadingCallback,
|
||||
completedCallback,
|
||||
refetch
|
||||
}) {
|
||||
export function PayableExportAll({ bodyshop, currentUser, billids, disabled, loadingCallback, completedCallback }) {
|
||||
const { t } = useTranslation();
|
||||
const [updateBill] = useMutation(UPDATE_BILLS);
|
||||
const [loading, setLoading] = useState(false);
|
||||
@@ -51,7 +43,7 @@ export function PayableExportAll({
|
||||
|
||||
setLoading(true);
|
||||
if (loadingCallback) loadingCallback(true);
|
||||
if (bodyshop.accountingconfig && bodyshop.accountingconfig.qbo) {
|
||||
if (bodyshop.accountingconfig?.qbo) {
|
||||
PartnerResponse = await axios.post(`/qbo/payables`, {
|
||||
bills: billids,
|
||||
elgen: true
|
||||
@@ -111,7 +103,7 @@ export function PayableExportAll({
|
||||
})
|
||||
})
|
||||
);
|
||||
if (!(bodyshop.accountingconfig && bodyshop.accountingconfig.qbo)) {
|
||||
if (!bodyshop.accountingconfig?.qbo) {
|
||||
//QBO Logs are handled server side.
|
||||
await insertExportLog({
|
||||
variables: {
|
||||
@@ -128,7 +120,7 @@ export function PayableExportAll({
|
||||
});
|
||||
}
|
||||
} else {
|
||||
if (!(bodyshop.accountingconfig && bodyshop.accountingconfig.qbo)) {
|
||||
if (!bodyshop.accountingconfig?.qbo) {
|
||||
//QBO Logs are handled server side.
|
||||
await insertExportLog({
|
||||
variables: {
|
||||
@@ -145,9 +137,7 @@ export function PayableExportAll({
|
||||
|
||||
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()
|
||||
@@ -169,18 +159,14 @@ export function PayableExportAll({
|
||||
});
|
||||
}
|
||||
}
|
||||
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