defect fixes

This commit is contained in:
2021-09-29 14:16:58 +01:00
parent 52f96652ec
commit bca85d36bc
8 changed files with 61 additions and 126 deletions
+6 -15
View File
@@ -2,18 +2,9 @@ import axios from "axios";
import https from "https";
import CryptoJS from "crypto-js";
const WEBAPI_URL = "https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/";
// const azureHeaders = {
// headers: {
// "OData-MaxVersion": "4.0",
// "OData-Version": "4.0",
// "Accept": "application/json",
// "Prefer": 'odata.include-annotations="*",return=representation',
// "Content-Type": "application/json",
// "ServiceBusAuthorization": SASToken,
// },
// };
const WEBAPI_URL =
process.env.RELAY_ROOT ||
"https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/";
const getSASToken = () => {
var m_ResourceURI = "dev-pedw-ns.servicebus.windows.net";
@@ -52,7 +43,7 @@ const getSASToken = () => {
};
export default async function ApiProxy(req, res) {
// console.log(req.method);
console.log(req.method);
var updateBody = {
"pinswg_areaofsiteinhectaresdec": 21,
@@ -104,14 +95,14 @@ export default async function ApiProxy(req, res) {
console.log(req.url.split("/api/proxy/")[1]);
return new Promise((resolve, reject) => {
// console.log(config);
//console.log(config);
axios(req.method == "GET" ? configNoData : config)
.then((response) => {
res.statusCode = 200;
res.setHeader("Content-Type", "application/json");
res.setHeader("Cache-Control", "max-age=1800000");
res.end(JSON.stringify(response.data));
// console.log("response data", response.data);
//console.log("response data", response.data);
resolve();
})
.catch((error) => {