add api_root and removed token calls from methods

This commit is contained in:
2022-01-12 12:10:32 +00:00
parent 23ba04678f
commit d6135a8109
29 changed files with 286 additions and 136 deletions
+3 -5
View File
@@ -1,7 +1,7 @@
import axios from "axios";
import https from "https";
import CryptoJS from "crypto-js";
import { getToken, azureHeadersPaged } from "../../../actions";
import { getToken, azureHeaders, azureHeadersPaged } from "../../../actions";
const WORDKEY = process.env.HASHKEY;
@@ -22,17 +22,15 @@ const hashAPIPath = (queryPath) => {
};
export default async function ApiProxy(req, res) {
var token = req.query.token;
var token = await getToken();
var queryUrl =
"incidents?$select=numberofchildincidents,_accountid_value,_customerid_value,_pinswg_associatedlpa_value,_ownerid_value,pinswg_appealcasetype,statuscode,ticketnumber,title, _primarycontactid_value&$expand=primarycontactid($select=fullname)&$filter=pinswg_appealcasetype eq 846040011 and pinswg_publishtoweb eq true&$orderby=createdon desc&$count=true";
console.log(WEBAPI_URL + queryUrl + hashAPIPath(queryUrl));
return axios
.get(
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
azureHeadersPaged(token)
azureHeadersPaged(token.access_token)
)
.then(({ data }) => {
res.status(200).json(data);