remove references to token

This commit is contained in:
2022-01-13 13:54:06 +00:00
parent af13552717
commit bef5e8abcc
52 changed files with 393 additions and 381 deletions
+1 -1
View File
@@ -2,6 +2,7 @@ import axios from "axios";
import https from "https";
import CryptoJS from "crypto-js";
import { getToken, azureHeadersPaged } from "../../../actions";
const WORDKEY = process.env.HASHKEY;
const WEBAPI_URL =
@@ -41,7 +42,6 @@ export default async function ApiProxy(req, res) {
return axios(config)
.then(({ data }) => {
console.log("deleted ");
res.status(200).json(data);
})
.catch(({ err }) => {
+63
View File
@@ -0,0 +1,63 @@
import axios from "axios";
import https from "https";
import CryptoJS from "crypto-js";
import _ from "lodash";
import { getToken, azureHeadersPaged } from "../../../actions";
const WORDKEY = process.env.HASHKEY;
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 contactid = req.query.contactid;
var appealTypeId = req.query.appealTypeId;
var lpaID = req.query.lpaID;
var queryUrl = "incidents";
var token = await getToken();
var data = JSON.stringify({
"title": "insertion test case",
"caseorigincode": 3,
"customerid_contact@odata.bind": "/contacts(" + contactid + ")",
"pinswg_appealcasetype": appealTypeId,
"pinswg_AssociatedLPA@odata.bind": "/accounts(" + lpaID + ")",
});
var config = {
method: "post",
url: WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
headers: {
"OData-MaxVersion": "4.0",
"OData-Version": "4.0",
"Accept": "application/json",
"Prefer": 'odata.include-annotations="*",return=representation',
"Authorization": "Bearer " + token.access_token,
"Content-Type": "application/json",
},
data: data,
};
var apiResponse = _.isEmpty(req.query)
? res.status(400).json()
: axios(config)
.then(({ data }) => {
res.status(200).json(data);
})
.catch(({ err }) => {
res.status(400).json(err);
});
}
@@ -2,6 +2,7 @@ import axios from "axios";
import https from "https";
import CryptoJS from "crypto-js";
import { getToken, azureHeadersPaged } from "../../../actions";
const WORDKEY = process.env.HASHKEY;
const WEBAPI_URL =
@@ -2,6 +2,7 @@ import axios from "axios";
import https from "https";
import CryptoJS from "crypto-js";
import { getToken, azureHeadersPaged } from "../../../actions";
const WORDKEY = process.env.HASHKEY;
const WEBAPI_URL =
@@ -2,6 +2,7 @@ import axios from "axios";
import https from "https";
import CryptoJS from "crypto-js";
import { getToken, azureHeadersPaged } from "../../../actions";
const WORDKEY = process.env.HASHKEY;
const WEBAPI_URL =
+27 -15
View File
@@ -1,7 +1,9 @@
import axios from "axios";
import https from "https";
import CryptoJS from "crypto-js";
import _ from "lodash";
import { getToken, azureHeadersPaged } from "../../../actions";
const WORDKEY = process.env.HASHKEY;
const WEBAPI_URL =
@@ -24,12 +26,14 @@ export default async function ApiProxy(req, res) {
var searchString = req.query.searchstring;
var token = await getToken();
searchString = JSON.parse(searchString);
searchString = _.isEmpty(searchString)
? searchString
: JSON.parse(decodeURI(searchString));
var queryString = "";
queryString +=
searchString.q != null
_.has(searchString, "q") && searchString.q != null
? "(contains(title, '" +
searchString.q +
"') or contains(ticketnumber,'" +
@@ -38,13 +42,13 @@ export default async function ApiProxy(req, res) {
: "";
queryString +=
searchString.lpa != null
_.has(searchString, "lpa") && searchString.lpa != null
? (typeof searchString.q == "undefined" ? "" : " and ") +
"_pinswg_associatedlpa_value eq " +
searchString.lpa
: "";
queryString +=
searchString.apt != null
_.has(searchString, "apt") && searchString.apt != null
? (typeof searchString.q == "undefined" &&
typeof searchString.lpa == "undefined"
? ""
@@ -58,15 +62,23 @@ export default async function ApiProxy(req, res) {
queryString +
" and pinswg_appealcasetype ne null and pinswg_publishtoweb eq true&$orderby=createdon desc&$count=true";
return axios
.get(
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
azureHeadersPaged(token.access_token)
)
.then(({ data }) => {
res.status(200).json(data);
})
.catch(({ err }) => {
res.status(400).json(err);
});
var apiResponse = _.isEmpty(searchString)
? res.status(400).json()
: axios
.get(
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
azureHeadersPaged(token.access_token)
)
.then(({ data }) => {
var dataStr;
_.has(data, "@odata.nextLink") == true &&
((dataStr = JSON.stringify(data["@odata.nextLink"])),
(data["@odata.nextLink"] = dataStr.split("/v8.2/")[1]));
res.status(200).json(data);
})
.catch(({ err }) => {
res.status(400).json(err);
});
return apiResponse;
}
@@ -27,12 +27,14 @@ export default async function ApiProxy(req, res) {
var pageNumber = req.query.pageNumber;
var token = await getToken();
searchString = JSON.parse(searchString);
searchString = _.isEmpty(searchString)
? searchString
: JSON.parse(decodeURI(searchString));
var queryString = "";
queryString +=
searchString.q != null
_.has(searchString, "q") && searchString.q != null
? "(contains(title, '" +
searchString.q +
"') or contains(ticketnumber,'" +
@@ -41,13 +43,13 @@ export default async function ApiProxy(req, res) {
: "";
queryString +=
searchString.lpa != null
_.has(searchString, "lpa") && searchString.lpa != null
? (typeof searchString.q == "undefined" ? "" : " and ") +
"_pinswg_associatedlpa_value eq " +
searchString.lpa
: "";
queryString +=
searchString.apt != null
_.has(searchString, "apt") && searchString.apt != null
? (typeof searchString.q == "undefined" &&
typeof searchString.lpa == "undefined"
? ""
@@ -64,19 +66,23 @@ export default async function ApiProxy(req, res) {
? "&$skiptoken=" + ('<cookie pagenumber="' + pageNumber + '" />')
: "");
return axios
.get(
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
azureHeadersPaged(token.access_token)
)
.then(({ data }) => {
var dataStr;
_.has(data, "@odata.nextLink") == true &&
((dataStr = JSON.stringify(data["@odata.nextLink"])),
(data["@odata.nextLink"] = dataStr.split("/v8.2/")[1]));
res.status(200).json(data);
})
.catch(({ err }) => {
res.status(400).json(err);
});
var apiResponse = _.isEmpty(searchString)
? res.status(400).json()
: axios
.get(
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
azureHeadersPaged(token.access_token)
)
.then(({ data }) => {
var dataStr;
_.has(data, "@odata.nextLink") == true &&
((dataStr = JSON.stringify(data["@odata.nextLink"])),
(data["@odata.nextLink"] = dataStr.split("/v8.2/")[1]));
res.status(200).json(data);
})
.catch(({ err }) => {
res.status(400).json(err);
});
return apiResponse;
}
+1
View File
@@ -2,6 +2,7 @@ import axios from "axios";
import https from "https";
import CryptoJS from "crypto-js";
import { getToken, azureHeaders } from "../../../actions";
const WORDKEY = process.env.HASHKEY;
const WEBAPI_URL =
+11
View File
@@ -2,6 +2,17 @@ import axios from "axios";
import https from "https";
import CryptoJS from "crypto-js";
import { getToken, azureHeadersPaged, azureHeaders } from "../../../actions";
/**
* @swagger
* /api/endpoint/getappealtypes_api:
* get:
* description: Returns appeal types
* responses:
* 200:
* description:
*
*/
const WORDKEY = process.env.HASHKEY;
const WEBAPI_URL =
@@ -1,6 +1,7 @@
import axios from "axios";
import https from "https";
import CryptoJS from "crypto-js";
import _ from "lodash";
import { getToken, azureHeaders, azureHeadersPaged } from "../../../actions";
const WORDKEY = process.env.HASHKEY;
@@ -33,6 +34,10 @@ export default async function ApiProxy(req, res) {
azureHeadersPaged(token.access_token)
)
.then(({ data }) => {
var dataStr;
_.has(data, "@odata.nextLink") == true &&
((dataStr = JSON.stringify(data["@odata.nextLink"])),
(data["@odata.nextLink"] = dataStr.split("/v8.2/")[1]));
res.status(200).json(data);
})
.catch(({ err }) => {
@@ -1,7 +1,9 @@
import axios from "axios";
import https from "https";
import CryptoJS from "crypto-js";
import _ from "lodash";
import { getToken, azureHeadersPaged } from "../../../actions";
const WORDKEY = process.env.HASHKEY;
const WEBAPI_URL =
@@ -29,15 +31,21 @@ export default async function ApiProxy(req, res) {
caseReference +
"'&$count=true";
return axios
.get(
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
azureHeaders(token.access_token)
)
.then(({ data }) => {
res.status(200).json(data);
})
.catch(({ err }) => {
res.status(400).json(err);
});
var apiResponse = _.isEmpty(req.query)
? res.status(400).json()
: typeof caseReference != "undefined" && caseReference.length > 0
? axios
.get(
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
azureHeaders(token.access_token)
)
.then(({ data }) => {
res.status(200).json(data);
})
.catch(({ err }) => {
res.status(400).json(err);
})
: res.status(400).json();
return apiResponse;
}
@@ -31,19 +31,25 @@ export default async function ApiProxy(req, res) {
caseReference +
"'&$count=true";
return axios
.get(
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
azureHeadersPaged(token.access_token)
)
.then(({ data }) => {
var dataStr;
_.has(data, "@odata.nextLink") == true &&
((dataStr = JSON.stringify(data["@odata.nextLink"])),
(data["@odata.nextLink"] = dataStr.split("/v8.2/")[1]));
return res.status(200).json(data);
})
.catch(({ err }) => {
res.status(400).json(err);
});
var apiResponse = _.isEmpty(req.query)
? res.status(400).json()
: typeof caseReference != "undefined" && caseReference.length > 0
? axios
.get(
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
azureHeadersPaged(token.access_token)
)
.then(({ data }) => {
var dataStr;
_.has(data, "@odata.nextLink") == true &&
((dataStr = JSON.stringify(data["@odata.nextLink"])),
(data["@odata.nextLink"] = dataStr.split("/v8.2/")[1]));
return res.status(200).json(data);
})
.catch(({ err }) => {
res.status(400).json(err);
})
: res.status(400).json();
return apiResponse;
}
+23 -11
View File
@@ -1,7 +1,9 @@
import axios from "axios";
import https from "https";
import CryptoJS from "crypto-js";
import _ from "lodash";
import { getToken, azureHeadersPaged } from "../../../actions";
const WORDKEY = process.env.HASHKEY;
const WEBAPI_URL =
@@ -31,15 +33,25 @@ export default async function ApiProxy(req, res) {
searchString +
"')) and pinswg_appealcasetype ne null and pinswg_publishtoweb eq true&$orderby=createdon desc&$count=true";
return axios
.get(
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
azureHeadersPaged(token.access_token)
)
.then(({ data }) => {
res.status(200).json(data);
})
.catch(({ err }) => {
res.status(400).json(err);
});
var apiResponse = _.isEmpty(req.query)
? res.status(400).json()
: searchString.length > 0
? axios
.get(
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
azureHeadersPaged(token.access_token)
)
.then(({ data }) => {
var dataStr;
_.has(data, "@odata.nextLink") == true &&
((dataStr = JSON.stringify(data["@odata.nextLink"])),
(data["@odata.nextLink"] = dataStr.split("/v8.2/")[1]));
res.status(200).json(data);
})
.catch(({ err }) => {
res.status(400).json(err);
})
: res.status(400).json();
return apiResponse;
}
@@ -2,6 +2,7 @@ import axios from "axios";
import https from "https";
import CryptoJS from "crypto-js";
import { getToken, azureHeaders } from "../../../actions";
const WORDKEY = process.env.HASHKEY;
const WEBAPI_URL =
+21 -15
View File
@@ -35,19 +35,25 @@ export default async function ApiProxy(req, res) {
? "&$skiptoken=" + '<cookie pagenumber="' + pageNumber + '" />'
: "");
return axios
.get(
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
azureHeadersPaged(token.access_token)
)
.then(({ data }) => {
var dataStr;
_.has(data, "@odata.nextLink") == true &&
((dataStr = JSON.stringify(data["@odata.nextLink"])),
(data["@odata.nextLink"] = dataStr.split("/v8.2/")[1]));
return res.status(200).json(data);
})
.catch(({ err }) => {
res.status(400).json(err);
});
var apiResponse =
searchString.length > 0
? axios
.get(
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
azureHeadersPaged(token.access_token)
)
.then(({ data }) => {
var dataStr;
_.has(data, "@odata.nextLink") == true &&
((dataStr = JSON.stringify(data["@odata.nextLink"])),
(data["@odata.nextLink"] =
dataStr.split("/v8.2/")[1]));
res.status(200).json(data);
})
.catch(({ err }) => {
res.status(400).json(err);
})
: res.status(400).json();
return apiResponse;
}
+19 -11
View File
@@ -1,7 +1,9 @@
import axios from "axios";
import https from "https";
import CryptoJS from "crypto-js";
import _ from "lodash";
import { getToken, azureHeaders } from "../../../actions";
const WORDKEY = process.env.HASHKEY;
const WEBAPI_URL =
@@ -26,15 +28,21 @@ export default async function ApiProxy(req, res) {
emailAddress +
"'&$count=true&$select=emailaddress1, contactid";
return axios
.get(
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
azureHeaders(token.access_token)
)
.then(({ data }) => {
res.status(200).json(data);
})
.catch(({ err }) => {
res.status(400).json(err);
});
var apiResponse = _.isEmpty(req.query)
? res.status(400).json()
: typeof emailAddress != "undefined" && emailAddress.length > 0
? axios
.get(
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
azureHeaders(token.access_token)
)
.then(({ data }) => {
res.status(200).json(data);
})
.catch(({ err }) => {
res.status(400).json(err);
})
: res.status(400).json();
return apiResponse;
}
+1
View File
@@ -2,6 +2,7 @@ import axios from "axios";
import https from "https";
import CryptoJS from "crypto-js";
import { getToken, azureHeadersPaged, azureHeaders } from "../../../actions";
const WORDKEY = process.env.HASHKEY;
const WEBAPI_URL =
+24 -11
View File
@@ -1,7 +1,9 @@
import axios from "axios";
import https from "https";
import CryptoJS from "crypto-js";
import _ from "lodash";
import { getToken, azureHeadersPaged } from "../../../actions";
const WORDKEY = process.env.HASHKEY;
const WEBAPI_URL =
@@ -29,15 +31,26 @@ export default async function ApiProxy(req, res) {
pwd +
"'&$count=true&$select=emailaddress1,contactid,pinswg_custom_password,yomifullname,firstname,lastname";
return axios
.get(
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
azureHeadersPaged(token.access_token)
)
.then(({ data }) => {
res.status(200).json(data);
})
.catch(({ err }) => {
res.status(400).json(err);
});
console.log(_.isEmpty(req.query));
var apiResponse = _.isEmpty(req.query)
? res.status(400).json()
: typeof emailAddress != "undefined" &&
emailAddress.length > 0 &&
typeof pwd != "undefined" &&
pwd.length > 0
? axios
.get(
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
azureHeadersPaged(token.access_token)
)
.then(({ data }) => {
res.status(200).json(data);
})
.catch(({ err }) => {
res.status(400).json(err);
})
: res.status(400).json();
return apiResponse;
}
+1
View File
@@ -2,6 +2,7 @@ import axios from "axios";
import https from "https";
import CryptoJS from "crypto-js";
import { getToken, azureHeadersPaged, azureHeaders } from "../../../actions";
const WORDKEY = process.env.HASHKEY;
const WEBAPI_URL =
@@ -2,6 +2,7 @@ import axios from "axios";
import https from "https";
import CryptoJS from "crypto-js";
import { getToken, azureHeadersPaged, azureHeaders } from "../../../actions";
const WORDKEY = process.env.HASHKEY;
const WEBAPI_URL =
+1
View File
@@ -2,6 +2,7 @@ import axios from "axios";
import https from "https";
import CryptoJS from "crypto-js";
import { getToken, azureHeaders } from "../../../actions";
const WORDKEY = process.env.HASHKEY;
const WEBAPI_URL =
@@ -2,6 +2,7 @@ import axios from "axios";
import https from "https";
import CryptoJS from "crypto-js";
import { getToken, azureHeaders } from "../../../actions";
const WORDKEY = process.env.HASHKEY;
const WEBAPI_URL =
@@ -2,6 +2,7 @@ import axios from "axios";
import https from "https";
import CryptoJS from "crypto-js";
import { getToken, azureHeaders } from "../../../actions";
const WORDKEY = process.env.HASHKEY;
const WEBAPI_URL =
+18 -11
View File
@@ -2,6 +2,7 @@ import axios from "axios";
import https from "https";
import CryptoJS from "crypto-js";
import { getToken, azureHeaders } from "../../../actions";
const WORDKEY = process.env.HASHKEY;
const WEBAPI_URL =
@@ -20,21 +21,27 @@ const hashAPIPath = (queryPath) => {
export default async function ApiProxy(req, res) {
var contactid = req.query.contactid;
var token = await getToken();
console.log(" eeee", contactid.length);
var queryUrl =
"contacts(" +
contactid +
")?$select=firstname, lastname, emailaddress1, telephone1, company, address1_line1,address1_line2,address1_city, address1_county,address1_postalcode&$count=true";
return axios
.get(
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
azureHeaders(token.access_token)
)
.then(({ data }) => {
res.status(200).json(data);
})
.catch(({ err }) => {
res.status(400).json(err);
});
var apiResponse =
contactid.length > 0
? axios
.get(
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
azureHeaders(token.access_token)
)
.then(({ data }) => {
res.status(200).json(data);
})
.catch(({ err }) => {
res.status(400).json(err);
})
: res.status(400).json();
return apiResponse;
}
+1
View File
@@ -2,6 +2,7 @@ import axios from "axios";
import https from "https";
import CryptoJS from "crypto-js";
import { getToken, azureHeaders } from "../../../actions";
const WORDKEY = process.env.HASHKEY;
const WEBAPI_URL =
@@ -2,6 +2,7 @@ import axios from "axios";
import https from "https";
import CryptoJS from "crypto-js";
import { getToken, azureHeaders } from "../../../actions";
const WORDKEY = process.env.HASHKEY;
const WEBAPI_URL =
@@ -2,6 +2,7 @@ import axios from "axios";
import https from "https";
import CryptoJS from "crypto-js";
import { getToken, azureHeaders } from "../../../actions";
const WORDKEY = process.env.HASHKEY;
const WEBAPI_URL =
@@ -2,6 +2,7 @@ import axios from "axios";
import https from "https";
import CryptoJS from "crypto-js";
import { getToken, azureHeaders } from "../../../actions";
const WORDKEY = process.env.HASHKEY;
const WEBAPI_URL =
@@ -2,6 +2,7 @@ import axios from "axios";
import https from "https";
import CryptoJS from "crypto-js";
import { getToken, azureHeaders } from "../../../actions";
const WORDKEY = process.env.HASHKEY;
const WEBAPI_URL =
@@ -2,6 +2,7 @@ import axios from "axios";
import https from "https";
import CryptoJS from "crypto-js";
import { getToken, azureHeaders } from "../../../actions";
const WORDKEY = process.env.HASHKEY;
const WEBAPI_URL =
@@ -2,6 +2,7 @@ import axios from "axios";
import https from "https";
import CryptoJS from "crypto-js";
import { getToken, azureHeaders } from "../../../actions";
const WORDKEY = process.env.HASHKEY;
const WEBAPI_URL =
@@ -2,6 +2,7 @@ import axios from "axios";
import https from "https";
import CryptoJS from "crypto-js";
import { getToken, azureHeaders } from "../../../actions";
const WORDKEY = process.env.HASHKEY;
const WEBAPI_URL =
+1
View File
@@ -2,6 +2,7 @@ import axios from "axios";
import https from "https";
import CryptoJS from "crypto-js";
import { getToken, azureHeadersPaged } from "../../../actions";
const WORDKEY = process.env.HASHKEY;
const WEBAPI_URL =
+1
View File
@@ -2,6 +2,7 @@ import axios from "axios";
import https from "https";
import CryptoJS from "crypto-js";
import { getToken, azureHeadersPaged } from "../../../actions";
const WORDKEY = process.env.HASHKEY;
const WEBAPI_URL =
+1
View File
@@ -2,6 +2,7 @@ import axios from "axios";
import https from "https";
import CryptoJS from "crypto-js";
import { getToken, azureHeadersPaged } from "../../../actions";
const WORDKEY = process.env.HASHKEY;
const WEBAPI_URL =