feat(ti imports): saving the post to xml as a reference
This commit is contained in:
@@ -1,11 +1,14 @@
|
||||
import axios from "axios";
|
||||
import querystring from "querystring";
|
||||
import { createLog } from "../../../../logger/logger.js";
|
||||
import { saveXml } from "../../../utils/saveXml.js";
|
||||
//tiCreds
|
||||
const userid = process.env.USERID || "";
|
||||
const password = process.env.PASSWORD || "";
|
||||
|
||||
export const postToTi = async (data: string) => {
|
||||
export const postToTi = async (data: string, fileName: string) => {
|
||||
// 🔹 Save the XML before posting
|
||||
saveXml(data, fileName);
|
||||
const formBody = querystring.stringify({
|
||||
userid,
|
||||
password,
|
||||
|
||||
@@ -272,7 +272,14 @@ export const tiImport = async () => {
|
||||
|
||||
//console.log("payload", payload);
|
||||
|
||||
const { data: tiPost, error: tiError } = await tryCatch(postToTi(payload));
|
||||
const { data: tiPost, error: tiError } = await tryCatch(
|
||||
postToTi(
|
||||
payload,
|
||||
`${orderData[0].addressAlias.replaceAll(" ", "")}-${
|
||||
header[0].releaseNumber
|
||||
}`
|
||||
)
|
||||
);
|
||||
|
||||
if (tiError) {
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user