Successful 2tier and 3 tier export of invoices. BOD-83 BOD-131
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
import { Button } from "antd";
|
||||
import axios from "axios";
|
||||
import React from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { auth } from "../../firebase/firebase.utils";
|
||||
|
||||
export default function JobsCloseExportButton({ jobId, disabled }) {
|
||||
const { t } = useTranslation();
|
||||
|
||||
const handleQbxml = async () => {
|
||||
const response = await axios.post(
|
||||
"/accounting/qbxml/receivables",
|
||||
{ jobId: jobId },
|
||||
{
|
||||
headers: {
|
||||
Authorization: `Bearer ${await auth.currentUser.getIdToken(true)}`,
|
||||
},
|
||||
}
|
||||
);
|
||||
console.log("handle -> XML", response);
|
||||
|
||||
try {
|
||||
const response2 = await axios.post(
|
||||
"http://e9c5a8ed9079.ngrok.io/qb/receivables",
|
||||
response.data,
|
||||
{
|
||||
headers: {
|
||||
Authorization: `Bearer ${await auth.currentUser.getIdToken(true)}`,
|
||||
},
|
||||
}
|
||||
);
|
||||
console.log("handle -> result", response2);
|
||||
} catch (error) {
|
||||
console.log("error", error, JSON.stringify(error));
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<Button onClick={handleQbxml} disabled={disabled} type="dashed">
|
||||
{t("jobs.actions.export")}
|
||||
</Button>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user