moved hashapipath to reusable single helper

This commit is contained in:
2026-03-16 11:13:41 +00:00
parent 023a8e9e6d
commit 18dfc60754
74 changed files with 298 additions and 1149 deletions
+1 -14
View File
@@ -15,25 +15,12 @@ import CryptoJS from "crypto-js";
import _ from "lodash";
import { consoleLogger } from "../../../actions/core/logger";
import { getToken } from "../../../actions/core/token";
const WORDKEY = process.env.HASHKEY;
import { hashAPIPath } from "../../../actions/core/hash";
const WEBAPI_URL =
process.env.RELAY_ROOT ||
"https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/";
const hashAPIPath = (queryPath) => {
var hashlink = CryptoJS.HmacSHA256(
queryPath,
CryptoJS.enc.Hex.parse(WORDKEY)
);
hashlink = hashlink.toString(CryptoJS.enc.Hex);
//return "&hash=" + hashlink;
return (queryPath.indexOf("?") > -1 ? "&hash=" : "?hash=") + hashlink;
};
export default async function ApiProxy(req, res) {
var incidentID = req.query.incidentid;
var queryUrl = "incidents(" + incidentID + ")";