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
+41 -67
View File
@@ -19,8 +19,6 @@ const API_PATH = "/api/data/v8.2/";
const accessTokenEndpoint = process.env.ACCESS_TOKEN_ENDPOINT;
const tenantId = process.env.TENANT;
//const WEBAPI_URL = "https://devcrm2016.llcdt.gov.wales/DVPINS" + API_PATH;
const WEBAPI_URL =
process.env.RELAY_ROOT ||
"https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/";
@@ -117,7 +115,7 @@ export const dehashString = (stringToDeHash) => {
return dehashedStr.toString(CryptoJS.enc.Utf8);
};
export const getBasicSearch = (token, searchString) => {
export const getBasicSearch = (searchString) => {
return axios
.get(
BASE_URL +
@@ -150,10 +148,7 @@ 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";
export const getBasicDNSSearch = (searchString) => {
return axios
.get(BASE_URL + "/api/endpoint/getbasicdnssearch_api")
.then((res) => res.data)
@@ -173,7 +168,7 @@ export const getBasicDNSSearchPaged = (pageNumber) => {
});
};
export const getAdvancedSearch = (token, searchString) => {
export const getAdvancedSearch = (searchString) => {
return axios
.get(
BASE_URL +
@@ -213,7 +208,6 @@ export const getAdvancedSearchPaged = (searchString, pageNumber) => {
};
export const getBasicSearchDetails = (
token,
appealTypeName,
caseReference,
primaryIdAttribute,
@@ -299,23 +293,19 @@ export const getSearchDocumentHistory = (documentID) => {
};
export const getSearchDocumentHistoryPaged = (documentID, pageNumber) => {
return (
axios
.get(
"/api/endpoint/getsearchdocumenthistorypaged_api?documentid=" +
documentID +
"&pageNumber=" +
pageNumber
)
// .get(queryUrl + hashAPIPath(queryUrl))
.then((res) => {
return res.data;
})
.catch((error) => {
console.log("thiserror", error);
})
);
return axios
.get(
"/api/endpoint/getsearchdocumenthistorypaged_api?documentid=" +
documentID +
"&pageNumber=" +
pageNumber
)
.then((res) => {
return res.data;
})
.catch((error) => {
console.log("thiserror", error);
});
};
export const getLinkedCases = (parentIncidentid) => {
@@ -333,7 +323,7 @@ export const getLinkedCases = (parentIncidentid) => {
});
};
export const getAppealsTypes = (token) => {
export const getAppealsTypes = () => {
return axios
.get(BASE_URL + "/api/endpoint/getappealtypes_api")
.then((res) => res.data)
@@ -349,7 +339,7 @@ export const getAppealsTypes = (token) => {
});
};
export const getLPA = (token) => {
export const getLPA = () => {
return axios
.get(BASE_URL + "/api/endpoint/getlpa_api")
.then((res) => {
@@ -369,7 +359,7 @@ export const getLPA = (token) => {
// iteration 2 methods
export const getFormData = (token, whichForm) => {
export const getFormData = (whichForm) => {
return axios
.get("/api/endpoint/getformdata_api?whichForm=" + whichForm)
.then((res) => res.data)
@@ -378,7 +368,7 @@ export const getFormData = (token, whichForm) => {
});
};
export const getMandatoryFields = (token, whichForm) => {
export const getMandatoryFields = (whichForm) => {
return axios
.get("/api/endpoint/getmandatoryfields_api?whichForm=" + whichForm)
.then((res) => res.data)
@@ -387,7 +377,7 @@ export const getMandatoryFields = (token, whichForm) => {
});
};
export const getPickLists = (token, whichForm) => {
export const getPickLists = (whichForm) => {
return axios
.get("/api/endpoint/getpicklists_api?whichForm=" + whichForm)
.then((res) => res.data)
@@ -396,7 +386,7 @@ export const getPickLists = (token, whichForm) => {
});
};
export const getPersonalAccount = (token, contactid) => {
export const getPersonalAccount = (contactid) => {
return axios
.get("/api/endpoint/getpersonalaccount_api?contactid=" + contactid)
.then((res) => {
@@ -451,35 +441,24 @@ export const getLogin = (emailAddress, pwd) => {
});
};
export const createCase = (token, appealTypeId, lpaID, contactid) => {
export const createCase = (appealTypeId, lpaID, contactid) => {
appealTypeId = parseInt(appealTypeId);
var queryUrl = "incidents";
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 queryUrl =
"/api/endpoint/createcase_api?appealTypeId=" +
appealTypeId +
"&lpaID=" +
lpaID +
"&contactid=" +
contactid;
var config = {
method: "post",
url: WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
headers: {
"OData-MaxVersion": "4.0",
"OData-Version": "4.0",
"Accept": "application/json;odata.metadata=none",
"Prefer": 'odata.include-annotations="*",return=representation',
"Content-Type": "application/json",
"Authorization": "Bearer " + token,
},
data: data,
url: queryUrl,
};
// console.log(config);
return axios(config)
.then((res) => {
// console.log("posted ", res.data);
return res.data;
})
.catch((error) => {
@@ -487,7 +466,7 @@ export const createCase = (token, appealTypeId, lpaID, contactid) => {
});
};
export const getMyCases = (token, loggedInUserId) => {
export const getMyCases = (loggedInUserId) => {
return axios
.get(
BASE_URL +
@@ -502,7 +481,7 @@ export const getMyCases = (token, loggedInUserId) => {
});
};
export const getMyRepresentations = (token, loggedInUserId) => {
export const getMyRepresentations = (loggedInUserId) => {
return axios
.get(
BASE_URL +
@@ -515,7 +494,7 @@ export const getMyRepresentations = (token, loggedInUserId) => {
});
};
export const getMyRepresentationsProxy = (token, loggedInUserId) => {
export const getMyRepresentationsProxy = (loggedInUserId) => {
return axios
.get(
BASE_URL +
@@ -537,9 +516,8 @@ export const getRepresentations = (incidentID) => {
});
};
export const getRepresentationsProxy = (token, incidentID) => {
export const getRepresentationsProxy = (incidentID) => {
return axios
.get(queryUrl + hashAPIPath(queryUrl))
.get(
BASE_URL +
"/api/endpoint/getrepresentationsproxy_api?incidentID=" +
@@ -551,7 +529,7 @@ export const getRepresentationsProxy = (token, incidentID) => {
});
};
export const getWatchedCases = (token, loggedInUserId) => {
export const getWatchedCases = (loggedInUserId) => {
return axios
.get(
BASE_URL +
@@ -564,7 +542,7 @@ export const getWatchedCases = (token, loggedInUserId) => {
});
};
export const getWatchedCasesProxy = (token, loggedInUserId) => {
export const getWatchedCasesProxy = (loggedInUserId) => {
return axios
.get(
BASE_URL +
@@ -577,7 +555,7 @@ export const getWatchedCasesProxy = (token, loggedInUserId) => {
});
};
export const getAwaitingSubmission = (token) => {
export const getAwaitingSubmission = () => {
return axios
.get(BASE_URL + "/api/lookups/awaitingSubmission", {
httpsAgent: new https.Agent({ rejectUnauthorized: false }),
@@ -588,7 +566,7 @@ export const getAwaitingSubmission = (token) => {
});
};
export const getPortalModuleDetails = (token, appealType, caseReference) => {
export const getPortalModuleDetails = (appealType, caseReference) => {
return axios
.get(
BASE_URL +
@@ -603,11 +581,7 @@ export const getPortalModuleDetails = (token, appealType, caseReference) => {
});
};
export const getPortalModuleDetailsProxy = (
token,
appealType,
caseReference
) => {
export const getPortalModuleDetailsProxy = (appealType, caseReference) => {
return axios
.get(
BASE_URL +