Merged PR 717: add api_root and removed token calls from methods
add api_root and removed token calls from methods Related work items: #7192
This commit is contained in:
+37
-89
@@ -121,16 +121,14 @@ export const getBasicSearch = (token, searchString) => {
|
||||
return axios
|
||||
.get(
|
||||
BASE_URL +
|
||||
"/api/endpoint/getbasicsearch_api?token=" +
|
||||
token +
|
||||
"&searchString=" +
|
||||
searchString,
|
||||
azureHeadersPaged(token)
|
||||
"api/endpoint/getbasicsearch_api?searchString=" +
|
||||
searchString
|
||||
)
|
||||
.then((res) => {
|
||||
return res.data;
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log(error);
|
||||
return error.response;
|
||||
});
|
||||
};
|
||||
@@ -157,10 +155,7 @@ export const getBasicDNSSearch = (token, searchString) => {
|
||||
"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";
|
||||
|
||||
return axios
|
||||
.get(
|
||||
BASE_URL + "/api/endpoint/getbasicdnssearch_api?token=" + token,
|
||||
azureHeadersPaged(token)
|
||||
)
|
||||
.get(BASE_URL + "/api/endpoint/getbasicdnssearch_api")
|
||||
.then((res) => res.data)
|
||||
.catch((error) => {
|
||||
return error.response;
|
||||
@@ -182,11 +177,8 @@ export const getAdvancedSearch = (token, searchString) => {
|
||||
return axios
|
||||
.get(
|
||||
BASE_URL +
|
||||
"/api/endpoint/getadvancedsearch_api?token=" +
|
||||
token +
|
||||
"&searchstring=" +
|
||||
JSON.stringify(searchString),
|
||||
azureHeadersPaged(token)
|
||||
"/api/endpoint/getadvancedsearch_api?searchstring=" +
|
||||
JSON.stringify(searchString)
|
||||
)
|
||||
.then((res) => res.data)
|
||||
.catch((error) => {
|
||||
@@ -227,19 +219,15 @@ export const getBasicSearchDetails = (
|
||||
primaryIdAttribute,
|
||||
incidentID
|
||||
) => {
|
||||
//console.log("check appealtype:", appealTypeName, caseReference);
|
||||
|
||||
var queryUrl =
|
||||
appealTypeName +
|
||||
"?$filter=_" +
|
||||
primaryIdAttribute +
|
||||
"s_value eq " +
|
||||
incidentID +
|
||||
"&$count=true";
|
||||
return axios
|
||||
.get(
|
||||
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
||||
azureHeadersPaged(token)
|
||||
BASE_URL +
|
||||
"/api/endpoint/getbasicsearchdetails_api?appealTypeName=" +
|
||||
appealTypeName +
|
||||
"&primaryIdAttribute=" +
|
||||
primaryIdAttribute +
|
||||
"&incidentID=" +
|
||||
incidentID
|
||||
)
|
||||
.then((res) => res.data)
|
||||
.catch((error) => {
|
||||
@@ -297,20 +285,17 @@ export const getSearchDocumentDetailsPaged = (incidentID, pageNumber) => {
|
||||
};
|
||||
|
||||
export const getSearchDocumentHistory = (documentID) => {
|
||||
return (
|
||||
axios
|
||||
//.get(queryUrl + hashAPIPath(queryUrl))
|
||||
.get(
|
||||
"/api/endpoint/getsearchdocumenthistory_api?documentid=" +
|
||||
documentID
|
||||
)
|
||||
.then((res) => {
|
||||
return res.data;
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log("thiserror", error);
|
||||
})
|
||||
);
|
||||
return axios
|
||||
.get(
|
||||
"/api/endpoint/getsearchdocumenthistory_api?documentid=" +
|
||||
documentID
|
||||
)
|
||||
.then((res) => {
|
||||
return res.data;
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log("thiserror", error);
|
||||
});
|
||||
};
|
||||
|
||||
export const getSearchDocumentHistoryPaged = (documentID, pageNumber) => {
|
||||
@@ -350,10 +335,7 @@ export const getLinkedCases = (parentIncidentid) => {
|
||||
|
||||
export const getAppealsTypes = (token) => {
|
||||
return axios
|
||||
.get(
|
||||
BASE_URL + "/api/endpoint/getappealtypes_api?token=" + token,
|
||||
azureHeaders(token)
|
||||
)
|
||||
.get(BASE_URL + "/api/endpoint/getappealtypes_api")
|
||||
.then((res) => res.data)
|
||||
.catch((error) => {
|
||||
console.log(error);
|
||||
@@ -369,10 +351,7 @@ export const getAppealsTypes = (token) => {
|
||||
|
||||
export const getLPA = (token) => {
|
||||
return axios
|
||||
.get(
|
||||
BASE_URL + "/api/endpoint/getlpa_api?token=" + token,
|
||||
azureHeaders(token)
|
||||
)
|
||||
.get(BASE_URL + "/api/endpoint/getlpa_api")
|
||||
.then((res) => {
|
||||
//console.log(res.data);
|
||||
return res.data;
|
||||
@@ -391,12 +370,8 @@ export const getLPA = (token) => {
|
||||
// iteration 2 methods
|
||||
|
||||
export const getFormData = (token, whichForm) => {
|
||||
var queryUrl =
|
||||
"systemforms?$select=formid,name,formxml,type,objecttypecode&$filter=(objecttypecode eq 'pinswg_" +
|
||||
whichForm +
|
||||
"' and type eq 2)&$count=true&$top=201";
|
||||
return axios
|
||||
.get(WEBAPI_URL + queryUrl + hashAPIPath(queryUrl), azureHeaders(token))
|
||||
.get("/api/endpoint/getformdata_api?whichForm=" + whichForm)
|
||||
.then((res) => res.data)
|
||||
.catch((error) => {
|
||||
console.log("thiserror", error);
|
||||
@@ -404,12 +379,8 @@ export const getFormData = (token, whichForm) => {
|
||||
};
|
||||
|
||||
export const getMandatoryFields = (token, whichForm) => {
|
||||
var queryUrl =
|
||||
"EntityDefinitions(LogicalName='pinswg_" +
|
||||
whichForm +
|
||||
"')/Attributes?$count=true&$select=LogicalName,RequiredLevel";
|
||||
return axios
|
||||
.get(WEBAPI_URL + queryUrl + hashAPIPath(queryUrl), azureHeaders(token))
|
||||
.get("/api/endpoint/getmandatoryfields_api?whichForm=" + whichForm)
|
||||
.then((res) => res.data)
|
||||
.catch((error) => {
|
||||
console.log("thiserror", error);
|
||||
@@ -417,12 +388,8 @@ export const getMandatoryFields = (token, whichForm) => {
|
||||
};
|
||||
|
||||
export const getPickLists = (token, whichForm) => {
|
||||
var queryUrl =
|
||||
"EntityDefinitions(LogicalName='pinswg_" +
|
||||
whichForm +
|
||||
"')/Attributes/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?$select=LogicalName&$expand=OptionSet,GlobalOptionSet&$count=true";
|
||||
return axios
|
||||
.get(WEBAPI_URL + queryUrl + hashAPIPath(queryUrl), azureHeaders(token))
|
||||
.get("/api/endpoint/getpicklists_api?whichForm=" + whichForm)
|
||||
.then((res) => res.data)
|
||||
.catch((error) => {
|
||||
console.log("thiserror", error);
|
||||
@@ -430,13 +397,8 @@ export const getPickLists = (token, whichForm) => {
|
||||
};
|
||||
|
||||
export const getPersonalAccount = (token, contactid) => {
|
||||
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))
|
||||
.get("/api/endpoint/getpersonalaccount_api?contactid=" + contactid)
|
||||
.then((res) => {
|
||||
console.log(res.data);
|
||||
return res.data;
|
||||
@@ -529,9 +491,7 @@ export const getMyCases = (token, loggedInUserId) => {
|
||||
return axios
|
||||
.get(
|
||||
BASE_URL +
|
||||
"/api/endpoint/getmycases_api?token=" +
|
||||
token +
|
||||
"&loggedInUserId=" +
|
||||
"/api/endpoint/getmycases_api?loggedInUserId=" +
|
||||
loggedInUserId
|
||||
)
|
||||
.then((res) => {
|
||||
@@ -546,9 +506,7 @@ export const getMyRepresentations = (token, loggedInUserId) => {
|
||||
return axios
|
||||
.get(
|
||||
BASE_URL +
|
||||
"/api/endpoint/getmyrepresentations_api?token=" +
|
||||
token +
|
||||
"&loggedInUserId=" +
|
||||
"/api/endpoint/getmyrepresentations_api?loggedInUserId=" +
|
||||
loggedInUserId
|
||||
)
|
||||
.then((res) => res.data)
|
||||
@@ -561,9 +519,7 @@ export const getMyRepresentationsProxy = (token, loggedInUserId) => {
|
||||
return axios
|
||||
.get(
|
||||
BASE_URL +
|
||||
"/api/endpoint/getmyrepresentationsproxy_api?token=" +
|
||||
token +
|
||||
"&loggedInUserId=" +
|
||||
"/api/endpoint/getmyrepresentationsproxy_api?loggedInUserId=" +
|
||||
loggedInUserId
|
||||
)
|
||||
.then((res) => res.data)
|
||||
@@ -586,9 +542,7 @@ export const getRepresentationsProxy = (token, incidentID) => {
|
||||
.get(queryUrl + hashAPIPath(queryUrl))
|
||||
.get(
|
||||
BASE_URL +
|
||||
"/api/endpoint/getrepresentationsproxy_api?token=" +
|
||||
token +
|
||||
"&incidentID=" +
|
||||
"/api/endpoint/getrepresentationsproxy_api?incidentID=" +
|
||||
incidentID
|
||||
)
|
||||
.then((res) => res.data)
|
||||
@@ -601,9 +555,7 @@ export const getWatchedCases = (token, loggedInUserId) => {
|
||||
return axios
|
||||
.get(
|
||||
BASE_URL +
|
||||
"/api/endpoint/getwatchedcases_api?token=" +
|
||||
token +
|
||||
"&loggedInUserId=" +
|
||||
"/api/endpoint/getwatchedcases_api?loggedInUserId=" +
|
||||
loggedInUserId
|
||||
)
|
||||
.then((res) => res.data)
|
||||
@@ -616,9 +568,7 @@ export const getWatchedCasesProxy = (token, loggedInUserId) => {
|
||||
return axios
|
||||
.get(
|
||||
BASE_URL +
|
||||
"/api/endpoint/getwatchedcasesproxy_api?token=" +
|
||||
token +
|
||||
"&loggedInUserId=" +
|
||||
"/api/endpoint/getwatchedcasesproxy_api?loggedInUserId=" +
|
||||
loggedInUserId
|
||||
)
|
||||
.then((res) => res.data)
|
||||
@@ -642,9 +592,7 @@ export const getPortalModuleDetails = (token, appealType, caseReference) => {
|
||||
return axios
|
||||
.get(
|
||||
BASE_URL +
|
||||
"/api/endpoint/getportalmoduledetails_api?token=" +
|
||||
token +
|
||||
"&appealType=" +
|
||||
"/api/endpoint/getportalmoduledetails_api?appealType=" +
|
||||
appealType +
|
||||
"&caseReference=" +
|
||||
caseReference
|
||||
|
||||
@@ -260,7 +260,6 @@ const DNSSearchResults = (props) => {
|
||||
|
||||
getBasicDNSSearchPaged(pageNumber)
|
||||
.then((data) => {
|
||||
console.log(data);
|
||||
setSearchResults(data);
|
||||
return data;
|
||||
})
|
||||
|
||||
@@ -90,3 +90,21 @@ export const getSearchDetailsPaged = (searchResultsObj) => {
|
||||
// console.log(detailsArr);
|
||||
return Promise.all(detailsArr);
|
||||
};
|
||||
|
||||
// export const absoluteUrl = (req, setLocalhost) => {
|
||||
// var protocol = "https:";
|
||||
// var host = req
|
||||
// ? req.headers["x-forwarded-host"] || req.headers["host"]
|
||||
// : window.location.host;
|
||||
|
||||
// if (host.indexOf("localhost") > -1) {
|
||||
// if (setLocalhost) host = setLocalhost;
|
||||
// protocol = "http:";
|
||||
// }
|
||||
|
||||
// return {
|
||||
// protocol: protocol,
|
||||
// host: host,
|
||||
// origin: protocol + "//" + host,
|
||||
// };
|
||||
// };
|
||||
|
||||
@@ -22,7 +22,7 @@ const hashAPIPath = (queryPath) => {
|
||||
|
||||
export default async function ApiProxy(req, res) {
|
||||
var searchString = req.query.searchstring;
|
||||
var token = req.query.token;
|
||||
var token = await getToken();
|
||||
|
||||
searchString = JSON.parse(searchString);
|
||||
|
||||
@@ -61,7 +61,7 @@ export default async function ApiProxy(req, res) {
|
||||
return axios
|
||||
.get(
|
||||
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
||||
azureHeadersPaged(token)
|
||||
azureHeadersPaged(token.access_token)
|
||||
)
|
||||
.then(({ data }) => {
|
||||
res.status(200).json(data);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
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;
|
||||
@@ -18,7 +19,7 @@ const hashAPIPath = (queryPath) => {
|
||||
|
||||
//return "&hash=" + hashlink;
|
||||
|
||||
return (hashPath.indexOf("?") > -1 ? "&hash=" : "?hash=") + hashlink;
|
||||
return (queryPath.indexOf("?") > -1 ? "&hash=" : "?hash=") + hashlink;
|
||||
};
|
||||
|
||||
export default async function ApiProxy(req, res) {
|
||||
@@ -69,6 +70,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,7 @@
|
||||
import axios from "axios";
|
||||
import https from "https";
|
||||
import CryptoJS from "crypto-js";
|
||||
import { getToken, azureHeadersPaged } from "../../../actions";
|
||||
import { getToken, azureHeaders } from "../../../actions";
|
||||
const WORDKEY = process.env.HASHKEY;
|
||||
|
||||
const WEBAPI_URL =
|
||||
@@ -34,7 +34,7 @@ export default async function ApiProxy(req, res) {
|
||||
return axios
|
||||
.get(
|
||||
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
||||
azureHeadersPaged(token.access_token)
|
||||
azureHeaders(token.access_token)
|
||||
)
|
||||
.then(({ data }) => {
|
||||
res.status(200).json(data);
|
||||
|
||||
@@ -21,13 +21,16 @@ const hashAPIPath = (queryPath) => {
|
||||
};
|
||||
|
||||
export default async function ApiProxy(req, res) {
|
||||
var token = req.query.token;
|
||||
var token = await getToken();
|
||||
|
||||
var queryUrl =
|
||||
"stringmaps?$filter=objecttypecode eq 'incident' and attributename eq 'pinswg_appealcasetype' and value ne 'LDP' and value ne 'Misc Casework'&$count=true&$select=value,stringmapid,organizationid,attributevalue&$orderby=value asc";
|
||||
|
||||
return axios
|
||||
.get(WEBAPI_URL + queryUrl + hashAPIPath(queryUrl), azureHeaders(token))
|
||||
.get(
|
||||
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
||||
azureHeaders(token.access_token)
|
||||
)
|
||||
.then(({ data }) => {
|
||||
res.status(200).json(data);
|
||||
})
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -22,7 +22,7 @@ const hashAPIPath = (queryPath) => {
|
||||
|
||||
export default async function ApiProxy(req, res) {
|
||||
var caseReference = req.query.caseReference;
|
||||
var token = req.query.token;
|
||||
var token = await getToken();
|
||||
|
||||
var queryUrl =
|
||||
"pinswg_dnses?$filter=pinswg_name eq '" +
|
||||
@@ -32,7 +32,7 @@ export default async function ApiProxy(req, res) {
|
||||
return axios
|
||||
.get(
|
||||
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
||||
azureHeadersPaged(token)
|
||||
azureHeaders(token.access_token)
|
||||
)
|
||||
.then(({ data }) => {
|
||||
res.status(200).json(data);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
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;
|
||||
@@ -36,7 +37,11 @@ export default async function ApiProxy(req, res) {
|
||||
azureHeadersPaged(token.access_token)
|
||||
)
|
||||
.then(({ data }) => {
|
||||
res.status(200).json(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);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
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;
|
||||
@@ -31,15 +32,17 @@ export default async function ApiProxy(req, res) {
|
||||
? "&$skiptoken=" + '<cookie pagenumber="' + pageNumber + '" />'
|
||||
: "");
|
||||
|
||||
console.log(WEBAPI_URL + queryUrl + hashAPIPath(queryUrl));
|
||||
|
||||
return axios
|
||||
.get(
|
||||
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
||||
azureHeadersPaged(token.access_token)
|
||||
)
|
||||
.then(({ data }) => {
|
||||
res.status(200).json(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);
|
||||
|
||||
@@ -22,7 +22,7 @@ const hashAPIPath = (queryPath) => {
|
||||
|
||||
export default async function ApiProxy(req, res) {
|
||||
var searchString = req.query.searchString;
|
||||
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=(contains(title, '" +
|
||||
@@ -34,7 +34,7 @@ export default async function ApiProxy(req, res) {
|
||||
return axios
|
||||
.get(
|
||||
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
||||
azureHeadersPaged(token)
|
||||
azureHeadersPaged(token.access_token)
|
||||
)
|
||||
.then(({ data }) => {
|
||||
res.status(200).json(data);
|
||||
|
||||
@@ -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 } from "../../../actions";
|
||||
const WORDKEY = process.env.HASHKEY;
|
||||
|
||||
const WEBAPI_URL =
|
||||
@@ -24,7 +24,7 @@ export default async function ApiProxy(req, res) {
|
||||
var appealTypeName = req.query.appealTypeName;
|
||||
var primaryIdAttribute = req.query.primaryIdAttribute;
|
||||
var incidentID = req.query.incidentID;
|
||||
var token = req.query.token;
|
||||
var token = await getToken();
|
||||
|
||||
var queryUrl =
|
||||
appealTypeName +
|
||||
@@ -37,7 +37,7 @@ export default async function ApiProxy(req, res) {
|
||||
return axios
|
||||
.get(
|
||||
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
||||
azureHeadersPaged(token)
|
||||
azureHeaders(token.access_token)
|
||||
)
|
||||
.then(({ data }) => {
|
||||
res.status(200).json(data);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
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;
|
||||
@@ -41,7 +42,11 @@ export default async function ApiProxy(req, res) {
|
||||
azureHeadersPaged(token.access_token)
|
||||
)
|
||||
.then(({ data }) => {
|
||||
res.status(200).json(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);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
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;
|
||||
@@ -40,7 +41,11 @@ export default async function ApiProxy(req, res) {
|
||||
azureHeadersPaged(token.access_token)
|
||||
)
|
||||
.then(({ data }) => {
|
||||
res.status(200).json(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);
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
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 =
|
||||
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 whichForm = req.query.whichForm;
|
||||
var token = await getToken();
|
||||
|
||||
var queryUrl =
|
||||
"systemforms?$select=formid,name,formxml,type,objecttypecode&$filter=(objecttypecode eq 'pinswg_" +
|
||||
whichForm +
|
||||
"' and type eq 2)&$count=true&$top=201";
|
||||
|
||||
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);
|
||||
});
|
||||
}
|
||||
@@ -21,13 +21,16 @@ const hashAPIPath = (queryPath) => {
|
||||
};
|
||||
|
||||
export default async function ApiProxy(req, res) {
|
||||
var token = req.query.token;
|
||||
var token = await getToken();
|
||||
|
||||
var queryUrl =
|
||||
"accounts?$count=true&$filter=pinswg_isalocalplanningauthorityaccount eq 846040000&$select=name&$orderby=name asc";
|
||||
|
||||
return axios
|
||||
.get(WEBAPI_URL + queryUrl + hashAPIPath(queryUrl), azureHeaders(token))
|
||||
.get(
|
||||
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
||||
azureHeaders(token.access_token)
|
||||
)
|
||||
.then(({ data }) => {
|
||||
res.status(200).json(data);
|
||||
})
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
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 =
|
||||
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 whichForm = req.query.whichForm;
|
||||
var token = await getToken();
|
||||
|
||||
var queryUrl =
|
||||
"EntityDefinitions(LogicalName='pinswg_" +
|
||||
whichForm +
|
||||
"')/Attributes?$count=true&$select=LogicalName,RequiredLevel";
|
||||
|
||||
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);
|
||||
});
|
||||
}
|
||||
@@ -19,7 +19,7 @@ const hashAPIPath = (queryPath) => {
|
||||
|
||||
export default async function ApiProxy(req, res) {
|
||||
var loggedInUserId = req.query.loggedInUserId;
|
||||
var token = req.query.token;
|
||||
var token = await getToken();
|
||||
|
||||
var queryUrl =
|
||||
"incidents?$select=ticketnumber,casetypecode,createdon,_customerid_value,description,incidentid,pinswg_appealcasetype,_pinswg_assignedinspectrids_value,statecode,statuscode,title&$filter=_customerid_value eq " +
|
||||
@@ -27,7 +27,10 @@ export default async function ApiProxy(req, res) {
|
||||
" and pinswg_appealcasetype ne null&$orderby=createdon desc&$count=true&$top=3";
|
||||
|
||||
return axios
|
||||
.get(WEBAPI_URL + queryUrl + hashAPIPath(queryUrl), azureHeaders(token))
|
||||
.get(
|
||||
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
||||
azureHeaders(token.access_token)
|
||||
)
|
||||
.then(({ data }) => {
|
||||
res.status(200).json(data);
|
||||
})
|
||||
|
||||
@@ -19,7 +19,7 @@ const hashAPIPath = (queryPath) => {
|
||||
|
||||
export default async function ApiProxy(req, res) {
|
||||
var loggedInUserId = req.query.loggedInUserId;
|
||||
var token = req.query.token;
|
||||
var token = await getToken();
|
||||
|
||||
var queryUrl =
|
||||
"pinswg_representationses?$filter= _pinswg_contact_value eq " +
|
||||
@@ -27,7 +27,10 @@ export default async function ApiProxy(req, res) {
|
||||
"&$count=true&$orderby=createdon desc";
|
||||
|
||||
return axios
|
||||
.get(WEBAPI_URL + queryUrl + hashAPIPath(queryUrl), azureHeaders(token))
|
||||
.get(
|
||||
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
||||
azureHeaders(token.access_token)
|
||||
)
|
||||
.then(({ data }) => {
|
||||
res.status(200).json(data);
|
||||
})
|
||||
|
||||
@@ -19,7 +19,7 @@ const hashAPIPath = (queryPath) => {
|
||||
|
||||
export default async function ApiProxy(req, res) {
|
||||
var loggedInUserId = req.query.loggedInUserId;
|
||||
var token = req.query.token;
|
||||
var token = await getToken();
|
||||
|
||||
var queryUrl =
|
||||
"pinswg_representationses?$filter= _pinswg_contact_value eq " +
|
||||
@@ -27,7 +27,10 @@ export default async function ApiProxy(req, res) {
|
||||
"&$count=true&$orderby=createdon desc";
|
||||
|
||||
return axios
|
||||
.get(WEBAPI_URL + queryUrl + hashAPIPath(queryUrl), azureHeaders(token))
|
||||
.get(
|
||||
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
||||
azureHeaders(token.access_token)
|
||||
)
|
||||
.then(({ data }) => {
|
||||
res.status(200).json(data);
|
||||
})
|
||||
|
||||
@@ -19,7 +19,7 @@ const hashAPIPath = (queryPath) => {
|
||||
|
||||
export default async function ApiProxy(req, res) {
|
||||
var contactid = req.query.contactid;
|
||||
var token = req.query.token;
|
||||
var token = await getToken();
|
||||
|
||||
var queryUrl =
|
||||
"contacts(" +
|
||||
@@ -27,7 +27,10 @@ export default async function ApiProxy(req, res) {
|
||||
")?$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))
|
||||
.get(
|
||||
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
||||
azureHeaders(token.access_token)
|
||||
)
|
||||
.then(({ data }) => {
|
||||
res.status(200).json(data);
|
||||
})
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
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 =
|
||||
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 (queryPath.indexOf("?") > -1 ? "&hash=" : "?hash=") + hashlink;
|
||||
};
|
||||
|
||||
export default async function ApiProxy(req, res) {
|
||||
var whichForm = req.query.whichForm;
|
||||
var token = await getToken();
|
||||
|
||||
var queryUrl =
|
||||
"EntityDefinitions(LogicalName='pinswg_" +
|
||||
whichForm +
|
||||
"')/Attributes/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?$select=LogicalName&$expand=OptionSet,GlobalOptionSet&$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);
|
||||
});
|
||||
}
|
||||
@@ -20,7 +20,7 @@ const hashAPIPath = (queryPath) => {
|
||||
export default async function ApiProxy(req, res) {
|
||||
var appealType = req.query.appealType;
|
||||
var caseReference = req.query.caseReference;
|
||||
var token = req.query.token;
|
||||
var token = await getToken();
|
||||
|
||||
var queryUrl =
|
||||
appealType +
|
||||
@@ -29,7 +29,10 @@ export default async function ApiProxy(req, res) {
|
||||
"'&$count=true";
|
||||
|
||||
return axios
|
||||
.get(WEBAPI_URL + queryUrl + hashAPIPath(queryUrl), azureHeaders(token))
|
||||
.get(
|
||||
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
||||
azureHeaders(token.access_token)
|
||||
)
|
||||
.then(({ data }) => {
|
||||
res.status(200).json(data);
|
||||
})
|
||||
|
||||
@@ -19,7 +19,7 @@ const hashAPIPath = (queryPath) => {
|
||||
|
||||
export default async function ApiProxy(req, res) {
|
||||
var incidentID = req.query.incidentID;
|
||||
var token = req.query.token;
|
||||
var token = await getToken();
|
||||
|
||||
var queryUrl =
|
||||
"pinswg_representationses?$filter= _pinswg_case_value eq " +
|
||||
@@ -27,7 +27,10 @@ export default async function ApiProxy(req, res) {
|
||||
"&$count=true&$orderby=createdon desc";
|
||||
|
||||
return axios
|
||||
.get(WEBAPI_URL + queryUrl + hashAPIPath(queryUrl), azureHeaders(token))
|
||||
.get(
|
||||
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
||||
azureHeaders(token.access_token)
|
||||
)
|
||||
.then(({ data }) => {
|
||||
res.status(200).json(data);
|
||||
})
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
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;
|
||||
@@ -54,7 +55,10 @@ export default async function ApiProxy(req, res) {
|
||||
element.pinswg_isharedocumentreference
|
||||
);
|
||||
});
|
||||
//console.log("details data:", 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);
|
||||
})
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
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;
|
||||
@@ -58,8 +59,11 @@ export default async function ApiProxy(req, res) {
|
||||
element.pinswg_isharedocumentreference
|
||||
);
|
||||
});
|
||||
//console.log("details paged data:", data);
|
||||
res.status(200).json(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);
|
||||
|
||||
@@ -19,7 +19,7 @@ const hashAPIPath = (queryPath) => {
|
||||
|
||||
export default async function ApiProxy(req, res) {
|
||||
var loggedInUserId = req.query.loggedInUserId;
|
||||
var token = req.query.token;
|
||||
var token = await getToken();
|
||||
|
||||
var queryUrl =
|
||||
"pinswg_watchlists?$filter= _pinswg_contact_value eq " +
|
||||
@@ -27,7 +27,10 @@ export default async function ApiProxy(req, res) {
|
||||
"&$count=true&$orderby=createdon desc";
|
||||
|
||||
return axios
|
||||
.get(WEBAPI_URL + queryUrl + hashAPIPath(queryUrl), azureHeaders(token))
|
||||
.get(
|
||||
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
||||
azureHeaders(token.access_token)
|
||||
)
|
||||
.then(({ data }) => {
|
||||
res.status(200).json(data);
|
||||
})
|
||||
|
||||
@@ -19,7 +19,7 @@ const hashAPIPath = (queryPath) => {
|
||||
|
||||
export default async function ApiProxy(req, res) {
|
||||
var loggedInUserId = req.query.loggedInUserId;
|
||||
var token = req.query.token;
|
||||
var token = await getToken();
|
||||
|
||||
var queryUrl =
|
||||
"pinswg_watchlists?$filter= _pinswg_contact_value eq " +
|
||||
@@ -27,7 +27,10 @@ export default async function ApiProxy(req, res) {
|
||||
"&$count=true&$orderby=createdon desc";
|
||||
|
||||
return axios
|
||||
.get(WEBAPI_URL + queryUrl + hashAPIPath(queryUrl), azureHeaders(token))
|
||||
.get(
|
||||
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
||||
azureHeaders(token.access_token)
|
||||
)
|
||||
.then(({ data }) => {
|
||||
res.status(200).json(data);
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user