IO-1689 Remove partner and acct path popups.
This commit is contained in:
@@ -1,8 +1,5 @@
|
||||
import { notification } from "antd";
|
||||
import axios from "axios";
|
||||
import React, { useEffect } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
|
||||
import { connect } from "react-redux";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
import { setPartnerVersion } from "../../redux/application/application.actions";
|
||||
@@ -22,44 +19,46 @@ export default connect(
|
||||
)(PartnerPingComponent);
|
||||
|
||||
export function PartnerPingComponent({ bodyshop, setPartnerVersion }) {
|
||||
const { t } = useTranslation();
|
||||
|
||||
useEffect(() => {
|
||||
// Create an scoped async function in the hook
|
||||
async function checkPartnerStatus() {
|
||||
if (!bodyshop) return;
|
||||
try {
|
||||
//if (process.env.NODE_ENV === "development") return;
|
||||
const PartnerResponse = await axios.post("http://localhost:1337/ping/");
|
||||
const { appver, qbpath } = PartnerResponse.data;
|
||||
setPartnerVersion(appver);
|
||||
console.log({ appver, qbpath });
|
||||
if (
|
||||
!qbpath &&
|
||||
!(
|
||||
bodyshop &&
|
||||
(bodyshop.cdk_dealerid ||
|
||||
bodyshop.pbs_serialnumber ||
|
||||
bodyshop.accountingconfig.qbo)
|
||||
)
|
||||
) {
|
||||
notification["error"]({
|
||||
title: "",
|
||||
message: t("general.messages.noacctfilepath"),
|
||||
});
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
notification["error"]({
|
||||
title: "",
|
||||
message: t("general.messages.partnernotrunning"),
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// Execute the created function directly
|
||||
checkPartnerStatus();
|
||||
checkPartnerStatus(bodyshop);
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [bodyshop]);
|
||||
|
||||
return <></>;
|
||||
}
|
||||
|
||||
export async function checkPartnerStatus(bodyshop, checkAcctPath = false) {
|
||||
if (!bodyshop) return;
|
||||
try {
|
||||
//if (process.env.NODE_ENV === "development") return;
|
||||
const PartnerResponse = await axios.post("http://localhost:1337/ping/");
|
||||
// const {
|
||||
// appver, //qbpath
|
||||
// } = PartnerResponse.data;
|
||||
setPartnerVersion(PartnerResponse.data);
|
||||
// if (
|
||||
// checkAcctPath &&
|
||||
// !qbpath &&
|
||||
// !(
|
||||
// bodyshop &&
|
||||
// (bodyshop.cdk_dealerid ||
|
||||
// bodyshop.pbs_serialnumber ||
|
||||
// bodyshop.accountingconfig.qbo)
|
||||
// )
|
||||
// ) {
|
||||
// notification["error"]({
|
||||
// title: "",
|
||||
// message: i18n.t("general.messages.noacctfilepath"),
|
||||
// });
|
||||
// }
|
||||
} catch (error) {
|
||||
console.log("ImEX Online Partner is not running.", error);
|
||||
// notification["error"]({
|
||||
// title: "",
|
||||
// message: i18n.t("general.messages.partnernotrunning"),
|
||||
// });
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user