add api_root and removed token calls from methods

This commit is contained in:
2022-01-12 12:10:32 +00:00
parent 23ba04678f
commit d6135a8109
29 changed files with 286 additions and 136 deletions
+37 -89
View File
@@ -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