diff --git a/.env.local b/.env.local
index 99d14d85..4e4be36c 100644
--- a/.env.local
+++ b/.env.local
@@ -1,9 +1,9 @@
// dev
-//RELAY_ROOT = https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/
-//RELAYURI = "dev-pedw-ns.servicebus.windows.net"
-//RELAYPATH = "dev-pedw-hc"
-//SASKEY = "Ml0Y/S/nfRcmIrHFRkO4jNm2J3iH52TSxPiak7+E1+Y="
-//SASKEYNAME = "devpedwnspolicy"
+RELAY_ROOT = https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/
+RELAYURI = "dev-pedw-ns.servicebus.windows.net"
+RELAYPATH = "dev-pedw-hc"
+SASKEY = "Ml0Y/S/nfRcmIrHFRkO4jNm2J3iH52TSxPiak7+E1+Y="
+SASKEYNAME = "devpedwnspolicy"
PORT= "3000"
@@ -23,15 +23,15 @@ I18N_DOMAIN = "cymru.local"
//preprod
-RELAY_ROOT = https://pp-pedw-ns.servicebus.windows.net/pp-pedw-hc/
-RELAYURI = "pp-pedw-ns.servicebus.windows.net"
-RELAYPATH = "pp-pedw-hc"
-SASKEY = "JzrOYfMTsGBD1cZHH2nkzqsbfDCqg0brO6jyiIDNVPo="
-SASKEYNAME = "pppedwnspolicy"
+//RELAY_ROOT = https://pp-pedw-ns.servicebus.windows.net/pp-pedw-hc/
+//RELAYURI = "pp-pedw-ns.servicebus.windows.net"
+//RELAYPATH = "pp-pedw-hc"
+//SASKEY = "JzrOYfMTsGBD1cZHH2nkzqsbfDCqg0brO6jyiIDNVPo="
+//SASKEYNAME = "pppedwnspolicy"
GOOGLE_TAG_MANAGER = GTM-T78CBC3
-SHOWLOGIN = "false"
+SHOWLOGIN = "true"
SHOWREPRESENTATIONS = "false"
BASIC_AUTH_CREDENTIALS,, = pinswg:password|pinswg2:password2
diff --git a/actions/index.js b/actions/index.js
index 69b05a42..73ff3666 100644
--- a/actions/index.js
+++ b/actions/index.js
@@ -2,10 +2,7 @@ import axios from "axios";
import https from "https";
import CryptoJS from "crypto-js";
import HmacSHA256 from "crypto-js/hmac-sha256";
-
-//import {XMLHttpRequest} from 'xmlhttprequest';
-
-//process.env["NODE_TLS_REJECT_UNAUTHORIZED"] = 0;
+import { has, indexOf } from "lodash";
let BASE_URL;
const port = parseInt(process.env.PORT, 10) || 3000;
@@ -105,12 +102,17 @@ const azureHeadersPaged = (SASToken) => {
};
};
-const hashProxyPath = (queryPath) => {
+const hashAPIPath = (queryPath) => {
+ var hashPath =
+ queryPath.indexOf("/api/proxy/") == -1
+ ? queryPath
+ : queryPath.split("/api/proxy/")[1];
+
var hashlink = CryptoJS.HmacSHA256(
- queryPath,
+ hashPath,
CryptoJS.enc.Hex.parse(WORDKEY)
);
- hashlink = hashlink.toString();
+ hashlink = hashlink.toString(CryptoJS.enc.Hex);
return "&hash=" + hashlink;
};
@@ -118,26 +120,22 @@ const hashProxyPath = (queryPath) => {
export const getBasicSearch = (token, searchString) => {
//console.log("\n\n", token, searchString);
+ 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, '" +
+ searchString +
+ "') or contains(ticketnumber, '" +
+ searchString +
+ "')) and pinswg_appealcasetype ne null and pinswg_publishtoweb eq true&$orderby=createdon desc&$count=true";
+
return axios
.get(
- WEBAPI_URL +
- "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, '" +
- searchString +
- "') or contains(ticketnumber, '" +
- searchString +
- "')) and pinswg_appealcasetype ne null and pinswg_publishtoweb eq true&$orderby=createdon desc&$count=true",
+ WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
azureHeadersPaged(token)
)
.then((res) => {
- // console.log(" ");
- // console.log("/////////////////////");
- // console.log("data:" + res.data.value);
- // console.log("/////////////////////");
- // console.log(" ");
return res.data;
})
.catch((error) => {
- //console.log("thiserror", error);
return error.response;
});
};
@@ -159,7 +157,7 @@ export const getBasicSearchPaged = (searchString, pageNumber) => {
//console.log(queryUrl);
return axios
- .get(queryUrl + hashProxyPath(queryUrl))
+ .get(queryUrl + hashAPIPath(queryUrl))
.then((res) => {
// console.log(" ");
// console.log("/////////////////////");
@@ -175,10 +173,12 @@ export const getBasicSearchPaged = (searchString, pageNumber) => {
};
export const getBasicDNSSearch = (token, searchString) => {
+ 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";
+
return axios
.get(
- WEBAPI_URL +
- "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",
+ WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
azureHeadersPaged(token)
)
.then((res) => res.data)
@@ -197,7 +197,7 @@ export const getBasicDNSSearchPaged = (pageNumber) => {
: "");
return axios
- .get(queryUrl + hashProxyPath(queryUrl))
+ .get(queryUrl + hashAPIPath(queryUrl))
.then((res) => res.data)
.catch((error) => {
return error.response;
@@ -234,12 +234,13 @@ export const getAdvancedSearch = (token, searchString) => {
searchString.apt
: "";
+ 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=" +
+ queryString +
+ " and pinswg_appealcasetype ne null and pinswg_publishtoweb eq true&$orderby=createdon desc&$count=true";
return axios
.get(
- WEBAPI_URL +
- "incidents?$select=numberofchildincidents,_accountid_value,_customerid_value,_pinswg_associatedlpa_value,_ownerid_value,pinswg_appealcasetype,statuscode,ticketnumber,title, _primarycontactid_value&$expand=primarycontactid($select=fullname)&$filter=" +
- queryString +
- " and pinswg_appealcasetype ne null and pinswg_publishtoweb eq true&$orderby=createdon desc&$count=true",
+ WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
azureHeadersPaged(token)
)
.then((res) => res.data)
@@ -294,7 +295,7 @@ export const getAdvancedSearchPaged = (searchString, pageNumber) => {
: "");
return axios
- .get(queryUrl + hashProxyPath(queryUrl))
+ .get(queryUrl + hashAPIPath(queryUrl))
.then((res) => res.data)
.catch((error) => {
let ErrResponse = {
@@ -314,15 +315,17 @@ export const getBasicSearchDetails = (
incidentID
) => {
//console.log("check appealtype:", appealType, caseReference);
+
+ var queryUrl =
+ appealTypeName +
+ "?$filter=_" +
+ primaryIdAttribute +
+ "s_value eq " +
+ incidentID +
+ "&$count=true";
return axios
.get(
- WEBAPI_URL +
- appealTypeName +
- "?$filter=_" +
- primaryIdAttribute +
- "s_value eq " +
- incidentID +
- "&$count=true",
+ WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
azureHeadersPaged(token)
)
.then((res) => res.data)
@@ -349,7 +352,7 @@ export const getBasicSearchDetailsPaged = (
"&$count=true";
return axios
- .get(queryUrl + hashProxyPath(queryUrl))
+ .get(queryUrl + hashAPIPath(queryUrl))
.then((res) => res.data)
.catch((error) => {
console.log("this error", error);
@@ -358,12 +361,13 @@ export const getBasicSearchDetailsPaged = (
export const getSearchDocumentDetails = (token, incidentID) => {
console.log(incidentID);
+ var queryUrl =
+ "pinswg_documents?$count=true&$filter=_pinswg_documentids_value eq " +
+ incidentID +
+ " and pinswg_publishtoweb eq true&$select=pinswg_isharedocumentlocations,_pinswg_documentids_value,pinswg_isharelabelcasetype,pinswg_isharelabellpaname,pinswg_publishtoweb,pinswg_uploadstatus,pinswg_isharedocumentclassification,pinswg_isharedocumentreference";
return axios
.get(
- WEBAPI_URL +
- "pinswg_documents?$count=true&$filter=_pinswg_documentids_value eq " +
- incidentID +
- " and pinswg_publishtoweb eq true&$select=pinswg_isharedocumentlocations,_pinswg_documentids_value,pinswg_isharelabelcasetype,pinswg_isharelabellpaname,pinswg_publishtoweb,pinswg_uploadstatus,pinswg_isharedocumentclassification,pinswg_isharedocumentreference",
+ WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
azureHeadersPaged(token)
)
.then((res) => res.data)
@@ -373,11 +377,12 @@ export const getSearchDocumentDetails = (token, incidentID) => {
};
export const getSearchDocumentHistory = (token, documentID) => {
+ var queryUrl =
+ "pinswg_documenthistories?$count=true&$select=_pinswg_documentid_value,pinswg_createddate,pinswg_state,pinswg_fileexists,statecode,pinswg_publisheddate&$filter=_pinswg_documentid_value eq " +
+ documentID;
return axios
.get(
- WEBAPI_URL +
- "pinswg_documenthistories?$count=true&$select=_pinswg_documentid_value,pinswg_createddate,pinswg_state,pinswg_fileexists,statecode,pinswg_publisheddate&$filter=_pinswg_documentid_value eq " +
- documentID,
+ WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
azureHeadersPaged(token)
)
.then((res) => res.data)
@@ -400,7 +405,7 @@ export const getSearchDocumentDetailsPaged = (incidentID, pageNumber) => {
: "");
return axios
- .get(queryUrl + hashProxyPath(queryUrl))
+ .get(queryUrl + hashAPIPath(queryUrl))
.then((res) => res.data)
.catch((error) => {
console.log("thiserror", error);
@@ -417,7 +422,7 @@ export const getSearchDocumentHistoryPaged = (documentID, pageNumber) => {
? "&$skiptoken=" + ('')
: "");
return axios
- .get(queryUrl + hashProxyPath(queryUrl))
+ .get(queryUrl + hashAPIPath(queryUrl))
.then((res) => res.data)
.catch((error) => {
console.log("thiserror", error);
@@ -432,7 +437,7 @@ export const getSearchDocumentDetails1 = (incidentID) => {
incidentID +
"&$select=pinswg_isharedocumentlocations,_pinswg_documentids_value,pinswg_isharelabelcasetype,pinswg_isharelabellpaname,pinswg_publishtoweb,pinswg_uploadstatus,pinswg_isharedocumentclassification,pinswg_isharedocumentreference";
return axios
- .get(queryUrl + hashProxyPath(queryUrl))
+ .get(queryUrl + hashAPIPath(queryUrl))
.then((res) => res.data)
.catch((error) => {
console.log("thiserror", error);
@@ -450,7 +455,7 @@ export const getSearchDocumentDetails1Paged = (incidentID, pageNumber) => {
? "&$skiptoken=" + ('')
: "");
return axios
- .get(queryUrl + hashProxyPath(queryUrl))
+ .get(queryUrl + hashAPIPath(queryUrl))
.then((res) => res.data)
.catch((error) => {
console.log("thiserror", error);
@@ -464,7 +469,7 @@ export const getSearchDocumentHistory1 = (documentID) => {
"/api/proxy/pinswg_documenthistories?$count=true&$select=_pinswg_documentid_value,pinswg_createddate,pinswg_state,pinswg_fileexists,statecode,pinswg_publisheddate&$filter=_pinswg_documentid_value eq " +
documentID;
return axios
- .get(queryUrl + hashProxyPath(queryUrl))
+ .get(queryUrl + hashAPIPath(queryUrl))
.then((res) => {
return res.data;
})
@@ -483,7 +488,7 @@ export const getSearchDocumentHistory1Paged = (documentID, pageNumber) => {
? "&$skiptoken=" + ('')
: "");
return axios
- .get(queryUrl + hashProxyPath(queryUrl))
+ .get(queryUrl + hashAPIPath(queryUrl))
.then((res) => {
return res.data;
})
@@ -493,12 +498,13 @@ export const getSearchDocumentHistory1Paged = (documentID, pageNumber) => {
};
export const getBasicDNSSearchDetails = (token, appealType, caseReference) => {
+ var queryUrl =
+ "pinswg_dnses?$filter=pinswg_name eq '" +
+ caseReference +
+ "'&$count=true";
return axios
.get(
- WEBAPI_URL +
- "pinswg_dnses?$filter=pinswg_name eq '" +
- caseReference +
- "'&$count=true",
+ WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
azureHeadersPaged(token)
)
.then((res) => res.data)
@@ -516,7 +522,7 @@ export const getBasicDNSSearchDetailsPaged = (caseReference) => {
"'&$count=true";
return axios
- .get(queryUrl + hashProxyPath(queryUrl))
+ .get(queryUrl + hashAPIPath(queryUrl))
.then((res) => res.data)
.catch((error) => {
console.log("thiserror", error);
@@ -530,7 +536,7 @@ export const getLinkedCases = (parentIncidentid) => {
parentIncidentid +
" and pinswg_appealcasetype ne null and pinswg_publishtoweb eq true &$select=title, incidentid";
return axios
- .get(queryUrl + hashProxyPath(queryUrl))
+ .get(queryUrl + hashAPIPath(queryUrl))
.then((res) => {
//console.log(" linked date", res.data);
return res.data;
@@ -541,16 +547,12 @@ export const getLinkedCases = (parentIncidentid) => {
};
export const getFormData = (token, whichForm) => {
- //console.log("got to axios", whichForm);
- //console.log("api_root: ", BASE_URL);
+ var queryUrl =
+ "systemforms?$select=formid,name,formxml,type,objecttypecode&$filter=(objecttypecode%20eq%20%27pinswg_" +
+ whichForm +
+ "%27and%20type%20eq%202)&$count=true&$top=201";
return axios
- .get(
- WEBAPI_URL +
- "systemforms?$select=formid,name,formxml,type,objecttypecode&$filter=(objecttypecode%20eq%20%27pinswg_" +
- whichForm +
- "%27and%20type%20eq%202)&$count=true&$top=201",
- azureHeaders(token)
- )
+ .get(WEBAPI_URL + queryUrl + hashAPIPath(queryUrl), azureHeaders(token))
.then((res) => res.data)
.catch((error) => {
console.log("thiserror", error);
@@ -558,14 +560,12 @@ 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 +
- "EntityDefinitions(LogicalName='pinswg_" +
- whichForm +
- "')/Attributes?$count=true&$select=LogicalName,RequiredLevel",
- azureHeaders(token)
- )
+ .get(WEBAPI_URL + queryUrl + hashAPIPath(queryUrl), azureHeaders(token))
.then((res) => res.data)
.catch((error) => {
console.log("thiserror", error);
@@ -573,14 +573,12 @@ 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 +
- "EntityDefinitions(LogicalName='pinswg_" +
- whichForm +
- "')/Attributes/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?$select=LogicalName&$expand=OptionSet,GlobalOptionSet&$count=true",
- azureHeaders(token)
- )
+ .get(WEBAPI_URL + queryUrl + hashAPIPath(queryUrl), azureHeaders(token))
.then((res) => res.data)
.catch((error) => {
console.log("thiserror", error);
@@ -588,12 +586,10 @@ export const getPickLists = (token, whichForm) => {
};
export const getAppealsTypes = (token) => {
+ 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 +
- "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",
- azureHeaders(token)
- )
+ .get(WEBAPI_URL + queryUrl + hashAPIPath(queryUrl), azureHeaders(token))
.then((res) => res.data)
.catch((error) => {
console.log(error);
@@ -609,12 +605,10 @@ export const getAppealsTypes = (token) => {
export const getLPA = (token) => {
// console.log("api_root: ", BASE_URL);
+ var queryUrl =
+ "accounts?$count=true&$filter=pinswg_isalocalplanningauthorityaccount eq 846040000&$select=name&$orderby=name asc";
return axios
- .get(
- WEBAPI_URL +
- "accounts?$count=true&$filter=pinswg_isalocalplanningauthorityaccount eq 846040000&$select=name&$orderby=name asc",
- azureHeaders(token)
- )
+ .get(WEBAPI_URL + queryUrl + hashAPIPath(queryUrl), azureHeaders(token))
.then((res) => {
//console.log(res.data);
return res.data;
@@ -631,15 +625,13 @@ export const getLPA = (token) => {
};
export const getPersonalAccount = (token, contactid) => {
- //console.log("getting personal details:", 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 +
- "contacts(" +
- contactid +
- ")?$select=firstname, lastname, emailaddress1, telephone1, company, address1_line1,address1_line2,address1_city, address1_county,address1_postalcode&$count=true",
- azureHeaders(token)
- )
+ .get(WEBAPI_URL + queryUrl + hashAPIPath(queryUrl), azureHeaders(token))
.then((res) => {
console.log(res.data);
return res.data;
@@ -660,7 +652,7 @@ export const getAppealID = (
updateFormCollection,
primaryAttribute
) => {
- const weburl =
+ const queryUrl =
"/api/proxy/" +
updateFormCollection +
"?$count=true&$select=_" +
@@ -669,9 +661,12 @@ export const getAppealID = (
caseReference +
"'";
- console.log("proxy url ", weburl);
+ console.log("proxy url ", queryUrl);
return axios
- .get(weburl, azureHeaders(getSASToken()))
+ .get(
+ WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
+ azureHeaders(getSASToken())
+ )
.then((res) => {
var appealID = res.data.value[0][primaryAttribute];
return appealID;
@@ -690,7 +685,7 @@ export const getLogin = (emailAddress, pwd) => {
"'&$count=true&$select=emailaddress1,%20contactid,pinswg_custom_password, yomifullname, firstname, lastname";
return axios
- .get(queryUrl + hashProxyPath(queryUrl))
+ .get(queryUrl + hashAPIPath(queryUrl))
.then((res) => res.data)
.catch((error) => {
console.log("thiserror", error);
@@ -699,6 +694,8 @@ export const getLogin = (emailAddress, pwd) => {
export const createCase = (token, appealTypeId, lpaID, contactid) => {
appealTypeId = parseInt(appealTypeId);
+
+ var queryUrl = "incidents";
var data = JSON.stringify({
"title": "insertion test case",
"caseorigincode": 3,
@@ -709,7 +706,7 @@ export const createCase = (token, appealTypeId, lpaID, contactid) => {
var config = {
method: "post",
- url: WEBAPI_URL + "incidents",
+ url: queryUrl + hashAPIPath(queryUrl),
headers: {
"OData-MaxVersion": "4.0",
"OData-Version": "4.0",
@@ -748,10 +745,11 @@ export const updateCase = async (
console.log("appeal obj ", appealObj);
+ var queryUrl = "/api/proxy/" + updateFormCollection + "(" + appealObj + ")";
var config = {
method: "patch",
- //url: WEBAPI_URL + updateFormCollection + "(" + incidentId + ")",
- url: "/api/proxy/" + updateFormCollection + "(" + appealObj + ")",
+ //url: updateFormCollection + "(" + incidentId + ")",
+ url: queryUrl + hashAPIPath(queryUrl),
headers: {
"OData-MaxVersion": "4.0",
"OData-Version": "4.0",
@@ -776,14 +774,12 @@ export const updateCase = async (
export const getMyCases = (token, loggedInUserId) => {
//console.log("in action ", loggedInUserId);
+ var queryUrl =
+ "incidents?$select=ticketnumber,casetypecode,createdon,_customerid_value,description,incidentid,pinswg_appealcasetype,_pinswg_assignedinspectrids_value,statecode,statuscode,title&$filter=_customerid_value eq " +
+ loggedInUserId +
+ " and pinswg_appealcasetype ne null&$orderby=createdon desc&$count=true&$top=3";
return axios
- .get(
- WEBAPI_URL +
- "incidents?$select=ticketnumber,casetypecode,createdon,_customerid_value,description,incidentid,pinswg_appealcasetype,_pinswg_assignedinspectrids_value,statecode,statuscode,title&$filter=_customerid_value eq " +
- loggedInUserId +
- " and pinswg_appealcasetype ne null&$orderby=createdon desc&$count=true&$top=3",
- azureHeaders(token)
- )
+ .get(WEBAPI_URL + queryUrl + hashAPIPath(queryUrl), azureHeaders(token))
.then((res) => {
return res.data;
})
@@ -793,14 +789,12 @@ export const getMyCases = (token, loggedInUserId) => {
};
export const getMyRepresentations = (token, loggedInUserId) => {
+ var queryUrl =
+ "pinswg_representationses?$filter= _pinswg_contact_value eq " +
+ loggedInUserId +
+ "&$count=true&$orderby=createdon desc";
return axios
- .get(
- WEBAPI_URL +
- "pinswg_representationses?$filter= _pinswg_contact_value eq " +
- loggedInUserId +
- "&$count=true&$orderby=createdon desc",
- azureHeaders(token)
- )
+ .get(WEBAPI_URL + queryUrl + hashAPIPath(queryUrl), azureHeaders(token))
.then((res) => res.data)
.catch((error) => {
console.log("this serror", error);
@@ -813,7 +807,7 @@ export const getMyRepresentationsProxy = (token, loggedInUserId) => {
loggedInUserId +
"&$count=true&$orderby=createdon desc";
return axios
- .get(queryUrl + hashProxyPath(queryUrl))
+ .get(queryUrl + hashAPIPath(queryUrl))
.then((res) => res.data)
.catch((error) => {
console.log("this serror", error);
@@ -821,9 +815,11 @@ export const getMyRepresentationsProxy = (token, loggedInUserId) => {
};
export const deleteMyRepresentations = (myRepresentationsID) => {
+ var queryUrl =
+ "/api/proxy/pinswg_representationses(" + myRepresentationsID + ")";
var config = {
method: "delete",
- url: "/api/proxy/pinswg_representationses(" + myRepresentationsID + ")",
+ url: queryUrl + hashAPIPath(queryUrl),
headers: {
"OData-MaxVersion": "4.0",
"OData-Version": "4.0",
@@ -850,7 +846,7 @@ export const getRepresentations = (incidentID) => {
incidentID +
" and pinswg_publishtoweb eq true&$count=true&$orderby=createdon desc";
return axios
- .get(queryUrl + hashProxyPath(queryUrl))
+ .get(queryUrl + hashAPIPath(queryUrl))
.then((res) => res.data)
.catch((error) => {
console.log("this serror", error);
@@ -863,7 +859,7 @@ export const getRepresentationsProxy = (token, incidentID) => {
incidentID +
"&$count=true&$orderby=createdon desc";
return axios
- .get(queryUrl + hashProxyPath(queryUrl))
+ .get(queryUrl + hashAPIPath(queryUrl))
.then((res) => res.data)
.catch((error) => {
console.log("this serror", error);
@@ -871,14 +867,12 @@ export const getRepresentationsProxy = (token, incidentID) => {
};
export const getWatchedCases = (token, loggedInUserId) => {
+ var queryUrl =
+ "pinswg_watchlists?$filter= _pinswg_contact_value eq " +
+ loggedInUserId +
+ "&$count=true&$orderby=createdon desc";
return axios
- .get(
- WEBAPI_URL +
- "pinswg_watchlists?$filter= _pinswg_contact_value eq " +
- loggedInUserId +
- "&$count=true&$orderby=createdon desc",
- azureHeaders(token)
- )
+ .get(WEBAPI_URL + queryUrl + hashAPIPath(queryUrl), azureHeaders(token))
.then((res) => res.data)
.catch((error) => {
console.log("this serror", error);
@@ -891,7 +885,7 @@ export const getWatchedCasesProxy = (token, loggedInUserId) => {
loggedInUserId +
"&$count=true&$orderby=createdon desc";
return axios
- .get(queryUrl | +hashProxyPath(queryUrl))
+ .get(queryUrl + hashAPIPath(queryUrl))
.then((res) => res.data)
.catch((error) => {
console.log("this serror", error);
@@ -900,10 +894,11 @@ export const getWatchedCasesProxy = (token, loggedInUserId) => {
export const createWatchedCases = (formValues) => {
var data = JSON.stringify(formValues);
+ var queryUrl = "/api/proxy/pinswg_watchlists";
var config = {
method: "post",
- url: "/api/proxy/pinswg_watchlists",
+ url: queryUrl + hashAPIPath(queryUrl),
headers: {
"OData-MaxVersion": "4.0",
"OData-Version": "4.0",
@@ -926,9 +921,10 @@ export const createWatchedCases = (formValues) => {
};
export const deleteWatchedCases = (watchedCaseID) => {
+ var queryUrl = "/api/proxy/pinswg_watchlists(" + watchedCaseID + ")";
var config = {
method: "delete",
- url: "/api/proxy/pinswg_watchlists(" + watchedCaseID + ")",
+ url: queryUrl + hashAPIPath(queryUrl),
headers: {
"OData-MaxVersion": "4.0",
"OData-Version": "4.0",
@@ -961,15 +957,13 @@ export const getAwaitingSubmission = (token) => {
};
export const getPortalModuleDetails = (token, appealType, caseReference) => {
+ var queryUrl =
+ appealType +
+ "?$filter=pinswg_name eq '" +
+ caseReference +
+ "'&$count=true";
return axios
- .get(
- WEBAPI_URL +
- appealType +
- "?$filter=pinswg_name eq '" +
- caseReference +
- "'&$count=true",
- azureHeaders(token)
- )
+ .get(WEBAPI_URL + queryUrl + hashAPIPath(queryUrl), azureHeaders(token))
.then((res) => res.data)
.catch((error) => {
console.log("thiserror", error);
@@ -988,7 +982,7 @@ export const getPortalModuleDetailsProxy = (
caseReference +
"'&$count=true";
return axios
- .get(queryUrl + hashProxyPath(queryUrl))
+ .get(queryUrl + hashAPIPath(queryUrl))
.then((res) => res.data)
.catch((error) => {
console.log("thiserror", error);
@@ -1002,7 +996,7 @@ export const getEmailAccountCheck = (emailAddress) => {
emailAddress +
"'&$count=true&$select=emailaddress1, contactid";
return axios
- .get(queryUrl + hashProxyPath(queryUrl))
+ .get(queryUrl + hashAPIPath(queryUrl))
.then((res) => res.data)
.catch((error) => {
console.log("thiserror", error);
@@ -1011,10 +1005,10 @@ export const getEmailAccountCheck = (emailAddress) => {
export const createAccount = (formValues) => {
var data = JSON.stringify(formValues);
-
+ var queryUrl = "/api/proxy/contacts";
var config = {
method: "post",
- url: "/api/proxy/contacts",
+ url: queryUrl + hashAPIPath(queryUrl),
headers: {
"OData-MaxVersion": "4.0",
"OData-Version": "4.0",
@@ -1038,10 +1032,10 @@ export const createAccount = (formValues) => {
export const updateAccount = (contactId, updateBody) => {
var data = JSON.stringify(updateBody);
-
+ var queryUrl = "/api/proxy/contacts(" + contactId + ")";
var config = {
method: "patch",
- url: "/api/proxy/contacts(" + contactId + ")",
+ url: queryUrl + hashAPIPath(queryUrl),
headers: {
"OData-MaxVersion": "4.0",
"OData-Version": "4.0",
@@ -1066,10 +1060,10 @@ export const updateAccount = (contactId, updateBody) => {
export const updatePassword = (contactId, newpassword) => {
let updateBody = { "pinswg_custom_password": newpassword };
var data = JSON.stringify(updateBody);
-
+ var queryUrl = "/api/proxy/contacts(" + contactId + ")";
var config = {
method: "patch",
- url: "/api/proxy/contacts(" + contactId + ")",
+ url: queryUrl + hashAPIPath(queryUrl),
headers: {
"OData-MaxVersion": "4.0",
"OData-Version": "4.0",
diff --git a/components/account/registerform.js b/components/account/registerform.js
index 2d0fd4fb..63981f1f 100644
--- a/components/account/registerform.js
+++ b/components/account/registerform.js
@@ -77,11 +77,12 @@ const RegisterForm = (props) => {
let errorsobj = {};
+ const emailRegex =
+ /(?:[a-z0-9!#$%&'*+\/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+\/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])/gi;
+
const required = (value) => (value ? undefined : "Is required");
const email = (value) =>
- value && !/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i.test(value)
- ? "Invalid email address"
- : undefined;
+ value && !emailRegex.test(value) ? "Invalid email address" : undefined;
const phoneNumber = (value) =>
value &&
!/^(?:(?:\(?(?:0(?:0|11)\)?[\s-]?\(?|\+)44\)?[\s-]?(?:\(?0\)?[\s-]?)?)|(?:\(?0))(?:(?:\d{5}\)?[\s-]?\d{4,5})|(?:\d{4}\)?[\s-]?(?:\d{5}|\d{3}[\s-]?\d{3}))|(?:\d{3}\)?[\s-]?\d{3}[\s-]?\d{3,4})|(?:\d{2}\)?[\s-]?\d{4}[\s-]?\d{4}))(?:[\s-]?(?:x|ext\.?|\#)\d{3,4})?$/i.test(
diff --git a/components/case/documents.js b/components/case/documents.js
index 1dfd07e7..89b1e867 100644
--- a/components/case/documents.js
+++ b/components/case/documents.js
@@ -195,13 +195,13 @@ const DocumentDetails = (props) => {
const encryptDocReference = (documentRef) => {
var hashlink = CryptoJS.HmacSHA256(
- "/api/proxy/documents/download/" + documentRef,
+ "documents/download/" + documentRef,
CryptoJS.enc.Hex.parse(WORDKEY)
);
- hashlink = hashlink.toString();
+ hashlink = hashlink.toString(CryptoJS.enc.Hex);
return (
- "/api/proxy/documents/download/" + documentRef + "&hash=" + hashlink
+ "/api/proxy/documents/download/" + documentRef + "?hash=" + hashlink
);
};
diff --git a/components/case/summaryTypes/pinswg_callinss77id.js b/components/case/summaryTypes/pinswg_callinss77id.js
index 8a42e738..4015e18a 100644
--- a/components/case/summaryTypes/pinswg_callinss77id.js
+++ b/components/case/summaryTypes/pinswg_callinss77id.js
@@ -234,7 +234,6 @@ const Pinswg_callinss77id = (props) => {
)}
-
{t(
@@ -260,7 +259,6 @@ const Pinswg_callinss77id = (props) => {
)}
-
{t(
@@ -286,7 +284,6 @@ const Pinswg_callinss77id = (props) => {
)}
-
{t(
@@ -325,7 +322,6 @@ const Pinswg_callinss77id = (props) => {
)}
-
{t(
@@ -351,7 +347,7 @@ const Pinswg_callinss77id = (props) => {
)}
-
+ {/*
{t(
"case:summary-inquiry-evidence-date-label"
@@ -375,7 +371,7 @@ const Pinswg_callinss77id = (props) => {
"case:summary-no-date-entered-label"
)}
-
+
*/}
{t("case:summary-event-date-label")}
@@ -399,7 +395,6 @@ const Pinswg_callinss77id = (props) => {
)}
-
{t("case:summary-decision-date-label")}
diff --git a/components/case/summaryTypes/pinswg_commonlandid.js b/components/case/summaryTypes/pinswg_commonlandid.js
index d62ff697..5c736e43 100644
--- a/components/case/summaryTypes/pinswg_commonlandid.js
+++ b/components/case/summaryTypes/pinswg_commonlandid.js
@@ -371,7 +371,7 @@ const Pinswg_commonlandid = (props) => {
)}
-
+ {/*
{t(
"case:summary-inquiry-evidence-date-label"
@@ -395,7 +395,7 @@ const Pinswg_commonlandid = (props) => {
"case:summary-no-date-entered-label"
)}
-
+
*/}
{t("case:summary-event-date-label")}
diff --git a/components/case/summaryTypes/pinswg_compulsorypurchaseordersid.js b/components/case/summaryTypes/pinswg_compulsorypurchaseordersid.js
index 352c8e82..5ae074b6 100644
--- a/components/case/summaryTypes/pinswg_compulsorypurchaseordersid.js
+++ b/components/case/summaryTypes/pinswg_compulsorypurchaseordersid.js
@@ -353,7 +353,7 @@ const Pinswg_compulsorypurchaseordersid = (props) => {
)}
-
+ {/*
{t(
"case:summary-inquiry-evidence-date-label"
@@ -377,7 +377,7 @@ const Pinswg_compulsorypurchaseordersid = (props) => {
"case:summary-no-date-entered-label"
)}
-
+
*/}
{t("case:summary-event-date-label")}
diff --git a/components/case/summaryTypes/pinswg_enforcementlistedbuildingconseid.js b/components/case/summaryTypes/pinswg_enforcementlistedbuildingconseid.js
index 6ce199e0..e1f57f9a 100644
--- a/components/case/summaryTypes/pinswg_enforcementlistedbuildingconseid.js
+++ b/components/case/summaryTypes/pinswg_enforcementlistedbuildingconseid.js
@@ -351,7 +351,7 @@ const Pinswg_enforcementlistedbuildingconseid = (props) => {
)}
-
+ {/*
{t(
"case:summary-inquiry-evidence-date-label"
@@ -375,7 +375,7 @@ const Pinswg_enforcementlistedbuildingconseid = (props) => {
"case:summary-no-date-entered-label"
)}
-
+
*/}
{t("case:summary-event-date-label")}
diff --git a/components/case/summaryTypes/pinswg_enforcementnoticeappeals174id.js b/components/case/summaryTypes/pinswg_enforcementnoticeappeals174id.js
index b9188127..8471d5ca 100644
--- a/components/case/summaryTypes/pinswg_enforcementnoticeappeals174id.js
+++ b/components/case/summaryTypes/pinswg_enforcementnoticeappeals174id.js
@@ -351,7 +351,7 @@ const Pinswg_enforcementnoticeappeals174id = (props) => {
)}
-
+ {/*
{t(
"case:summary-inquiry-evidence-date-label"
@@ -375,7 +375,7 @@ const Pinswg_enforcementnoticeappeals174id = (props) => {
"case:summary-no-date-entered-label"
)}
-
+
*/}
{t("case:summary-event-date-label")}
diff --git a/components/case/summaryTypes/pinswg_environmentalpermittingid.js b/components/case/summaryTypes/pinswg_environmentalpermittingid.js
index c700bcfc..46046924 100644
--- a/components/case/summaryTypes/pinswg_environmentalpermittingid.js
+++ b/components/case/summaryTypes/pinswg_environmentalpermittingid.js
@@ -371,7 +371,7 @@ const Pinswg_environmentalpermittingid = (props) => {
)}
-
+ {/*
{t(
"case:summary-inquiry-evidence-date-label"
@@ -395,7 +395,7 @@ const Pinswg_environmentalpermittingid = (props) => {
"case:summary-no-date-entered-label"
)}
-
+
*/}
{t("case:summary-event-date-label")}
diff --git a/components/case/summaryTypes/pinswg_hedgeshedgerowstreepreservatioid.js b/components/case/summaryTypes/pinswg_hedgeshedgerowstreepreservatioid.js
index 7c96fa13..f2d87455 100644
--- a/components/case/summaryTypes/pinswg_hedgeshedgerowstreepreservatioid.js
+++ b/components/case/summaryTypes/pinswg_hedgeshedgerowstreepreservatioid.js
@@ -371,7 +371,7 @@ const Pinswg_hedgeshedgerowstreepreservatioid = (props) => {
)}
-
+ {/*
{t(
"case:summary-inquiry-evidence-date-label"
@@ -395,7 +395,7 @@ const Pinswg_hedgeshedgerowstreepreservatioid = (props) => {
"case:summary-no-date-entered-label"
)}
-
+
*/}
{t("case:summary-event-date-label")}
diff --git a/components/case/summaryTypes/pinswg_lawfuldevelopmentcertificatappid.js b/components/case/summaryTypes/pinswg_lawfuldevelopmentcertificatappid.js
index 99a61008..1bcfeaa7 100644
--- a/components/case/summaryTypes/pinswg_lawfuldevelopmentcertificatappid.js
+++ b/components/case/summaryTypes/pinswg_lawfuldevelopmentcertificatappid.js
@@ -351,7 +351,7 @@ const Pinswg_lawfuldevelopmentcertificatappid = (props) => {
)}
-
+ {/*
{t(
"case:summary-inquiry-evidence-date-label"
@@ -375,7 +375,7 @@ const Pinswg_lawfuldevelopmentcertificatappid = (props) => {
"case:summary-no-date-entered-label"
)}
-
+
*/}
{t("case:summary-event-date-label")}
diff --git a/components/case/summaryTypes/pinswg_ldpid.js b/components/case/summaryTypes/pinswg_ldpid.js
index 87db0d60..40bda60f 100644
--- a/components/case/summaryTypes/pinswg_ldpid.js
+++ b/components/case/summaryTypes/pinswg_ldpid.js
@@ -351,7 +351,7 @@ const Pinswg_ldpid = (props) => {
)}
-
+ {/*
{t(
"case:summary-inquiry-evidence-date-label"
@@ -375,7 +375,7 @@ const Pinswg_ldpid = (props) => {
"case:summary-no-date-entered-label"
)}
-
+
*/}
{t("case:summary-event-date-label")}
diff --git a/components/case/summaryTypes/pinswg_listedbuildingandconservationrid.js b/components/case/summaryTypes/pinswg_listedbuildingandconservationrid.js
index b17601e5..78cecdb4 100644
--- a/components/case/summaryTypes/pinswg_listedbuildingandconservationrid.js
+++ b/components/case/summaryTypes/pinswg_listedbuildingandconservationrid.js
@@ -351,7 +351,7 @@ const Pinswg_listedbuildingandconservationrid = (props) => {
)}
-
+ {/*
{t(
"case:summary-inquiry-evidence-date-label"
@@ -375,7 +375,7 @@ const Pinswg_listedbuildingandconservationrid = (props) => {
"case:summary-no-date-entered-label"
)}
-
+
*/}
{t("case:summary-event-date-label")}
diff --git a/components/case/summaryTypes/pinswg_maintenanceoflands217id.js b/components/case/summaryTypes/pinswg_maintenanceoflands217id.js
index baf67bda..b22f5d55 100644
--- a/components/case/summaryTypes/pinswg_maintenanceoflands217id.js
+++ b/components/case/summaryTypes/pinswg_maintenanceoflands217id.js
@@ -351,7 +351,7 @@ const Pinswg_maintenanceoflands217id = (props) => {
)}
-
+ {/*
{t(
"case:summary-inquiry-evidence-date-label"
@@ -375,7 +375,7 @@ const Pinswg_maintenanceoflands217id = (props) => {
"case:summary-no-date-entered-label"
)}
-
+
*/}
{t("case:summary-event-date-label")}
diff --git a/components/case/summaryTypes/pinswg_miscellaneouscasewordid.js b/components/case/summaryTypes/pinswg_miscellaneouscasewordid.js
index 9664e6f4..5a62e29c 100644
--- a/components/case/summaryTypes/pinswg_miscellaneouscasewordid.js
+++ b/components/case/summaryTypes/pinswg_miscellaneouscasewordid.js
@@ -371,7 +371,7 @@ const Pinswg_miscellaneouscasewordid = (props) => {
)}
-
+ {/*
{t(
"case:summary-inquiry-evidence-date-label"
@@ -395,7 +395,7 @@ const Pinswg_miscellaneouscasewordid = (props) => {
"case:summary-no-date-entered-label"
)}
-
+
*/}
{t("case:summary-event-date-label")}
diff --git a/components/case/summaryTypes/pinswg_planningappeals78id.js b/components/case/summaryTypes/pinswg_planningappeals78id.js
index 26267f78..bc4d224b 100644
--- a/components/case/summaryTypes/pinswg_planningappeals78id.js
+++ b/components/case/summaryTypes/pinswg_planningappeals78id.js
@@ -351,7 +351,7 @@ const Pinswg_planningappeals78id = (props) => {
)}
-
+ {/*
{t(
"case:summary-inquiry-evidence-date-label"
@@ -375,7 +375,7 @@ const Pinswg_planningappeals78id = (props) => {
"case:summary-no-date-entered-label"
)}
-
+
*/}
{t("case:summary-event-date-label")}
diff --git a/components/case/summaryTypes/pinswg_planningconditionss73s79id.js b/components/case/summaryTypes/pinswg_planningconditionss73s79id.js
index f5566e9e..77b4699c 100644
--- a/components/case/summaryTypes/pinswg_planningconditionss73s79id.js
+++ b/components/case/summaryTypes/pinswg_planningconditionss73s79id.js
@@ -351,7 +351,7 @@ const Pinswg_planningconditionss73s79id = (props) => {
)}
-
+ {/*
{t(
"case:summary-inquiry-evidence-date-label"
@@ -375,7 +375,7 @@ const Pinswg_planningconditionss73s79id = (props) => {
"case:summary-no-date-entered-label"
)}
-
+
*/}
{t("case:summary-event-date-label")}
diff --git a/components/case/summaryTypes/pinswg_planningobligationappeals106id.js b/components/case/summaryTypes/pinswg_planningobligationappeals106id.js
index ba01be70..0b315ebb 100644
--- a/components/case/summaryTypes/pinswg_planningobligationappeals106id.js
+++ b/components/case/summaryTypes/pinswg_planningobligationappeals106id.js
@@ -351,7 +351,7 @@ const Pinswg_planningobligationappeals106id = (props) => {
)}
-
+ {/*
{t(
"case:summary-inquiry-evidence-date-label"
@@ -375,7 +375,7 @@ const Pinswg_planningobligationappeals106id = (props) => {
"case:summary-no-date-entered-label"
)}
-
+
*/}
{t("case:summary-event-date-label")}
diff --git a/components/case/summaryTypes/pinswg_rowid.js b/components/case/summaryTypes/pinswg_rowid.js
index d65d2f65..9167e86c 100644
--- a/components/case/summaryTypes/pinswg_rowid.js
+++ b/components/case/summaryTypes/pinswg_rowid.js
@@ -371,7 +371,7 @@ const Pinswg_rowid = (props) => {
)}
-
+ {/*
{t(
"case:summary-inquiry-evidence-date-label"
@@ -395,7 +395,7 @@ const Pinswg_rowid = (props) => {
"case:summary-no-date-entered-label"
)}
-
+
*/}
{t("case:summary-event-date-label")}
diff --git a/components/case/summaryTypes/pinswg_wayleaveid.js b/components/case/summaryTypes/pinswg_wayleaveid.js
index 7849befd..206f7295 100644
--- a/components/case/summaryTypes/pinswg_wayleaveid.js
+++ b/components/case/summaryTypes/pinswg_wayleaveid.js
@@ -371,7 +371,7 @@ const Pinswg_wayleaveid = (props) => {
)}
-
+ {/*
{t(
"case:summary-inquiry-evidence-date-label"
@@ -395,7 +395,7 @@ const Pinswg_wayleaveid = (props) => {
"case:summary-no-date-entered-label"
)}
-
+
*/}
{t("case:summary-event-date-label")}
diff --git a/locales/cy/common.json b/locales/cy/common.json
index c1c50d62..6ba8ba67 100644
--- a/locales/cy/common.json
+++ b/locales/cy/common.json
@@ -30,7 +30,7 @@
"footer-alternative-languages-link-label": "Ieithoedd amgen",
"footer-alternative-languages-link": "https://llyw.cymru/ieithoedd-amgen",
"footer-guidance-link-label": "Canllawiau a gwasanaethau Penderfyniadau Cynllunio ac Amgylchedd Cymru",
- "footer-guidance-link": "https://gov.wales/planning-and-environment-decisions-wales/guidance-services",
+ "footer-guidance-link": "https://llyw.cymru/penderfyndiadau-cynllunio-ac-amgylchedd-cymru/canllawiau-gwasanaethau",
"mobile-nav-label": "Dewislen",
"signout-label": "Allgofnodwch",
"back-to-top-link": "Nôl i dop y dudalen",
diff --git a/pages/api/proxy/[...route].js b/pages/api/proxy/[...route].js
index fb32bd9f..aa099a0c 100644
--- a/pages/api/proxy/[...route].js
+++ b/pages/api/proxy/[...route].js
@@ -52,13 +52,18 @@ const getSASToken = () => {
function checkProxyPath(queryPath) {
const WORDKEY = process.env.NEXT_PUBLIC_HASHKEY;
+ var hashPath =
+ queryPath.indexOf("/api/proxy/") == -1
+ ? queryPath
+ : queryPath.split("/api/proxy/")[1];
+
const wordKey = WORDKEY;
var hashlink = CryptoJS.HmacSHA256(
- decodeURI(queryPath),
+ decodeURI(hashPath),
CryptoJS.enc.Hex.parse(wordKey)
);
- hashlink = hashlink.toString();
+ hashlink = hashlink.toString(CryptoJS.enc.Hex);
return hashlink;
}
@@ -66,13 +71,24 @@ function checkProxyPath(queryPath) {
export default async function ApiProxy(req, res) {
var data = JSON.stringify(req.body);
const SASToken = getSASToken();
+ const isDocument = req.url.indexOf("/documents/download") > -1;
+
+ let hashCheckPath = isDocument
+ ? req.url.split("?hash=")[0]
+ : req.url.split("&hash=")[0];
+ let hashCheckValue = isDocument
+ ? req.url.split("?hash=")[1]
+ : req.url.split("&hash=")[1];
+ let hashFromRequest = checkProxyPath(hashCheckPath);
var configNoData = {
method: req.method,
//url: PROXY_RELAY_URL + updateFormCollection + "(" + incidentId + ")",
url:
PROXY_RELAY_URL +
- req.url.split("&hash=")[0].split("/api/proxy/")[1],
+ req.url.split("&hash=")[0].split("/api/proxy/")[1] +
+ "&hash=" +
+ req.url.split("&hash=")[1],
headers: {
"OData-MaxVersion": "4.0",
"OData-Version": "4.0",
@@ -86,7 +102,11 @@ export default async function ApiProxy(req, res) {
var config = {
method: req.method,
- url: PROXY_RELAY_URL + req.query.route[0],
+ url:
+ PROXY_RELAY_URL +
+ req.query.route[0] +
+ "&hash=" +
+ req.url.split("&hash=")[1],
headers: {
"OData-MaxVersion": "4.0",
"OData-Version": "4.0",
@@ -102,7 +122,9 @@ export default async function ApiProxy(req, res) {
method: req.method,
url:
PROXY_RELAY_URL +
- req.url.split("&hash=")[0].split("/api/proxy/")[1],
+ req.url.split("?hash=")[0].split("/api/proxy/")[1] +
+ "?hash=" +
+ req.url.split("?hash=")[1],
headers: {
"OData-MaxVersion": "4.0",
"OData-Version": "4.0",
@@ -114,10 +136,6 @@ export default async function ApiProxy(req, res) {
responseType: "arraybuffer",
};
- let hashCheckPath = req.url.split("&hash=")[0];
- let hashCheckValue = req.url.split("&hash=")[1];
- let hashFromRequest = checkProxyPath(hashCheckPath);
-
if (hashCheckValue == hashFromRequest) {
return new Promise((resolve, reject) => {
let hasDocument =