remove references to token
This commit is contained in:
+1
-1
@@ -43,7 +43,7 @@ RELAYPATH = "prod-pedw-hc"
|
|||||||
|
|
||||||
|
|
||||||
GOOGLE_TAG_MANAGER = GTM-T78CBC3
|
GOOGLE_TAG_MANAGER = GTM-T78CBC3
|
||||||
SHOWLOGIN = "false"
|
SHOWLOGIN = "true"
|
||||||
SHOWREPRESENTATIONS = "false"
|
SHOWREPRESENTATIONS = "false"
|
||||||
BASIC_AUTH_CREDENTIALS = pinswg:password|pinswg2:password2
|
BASIC_AUTH_CREDENTIALS = pinswg:password|pinswg2:password2
|
||||||
|
|
||||||
|
|||||||
+41
-67
@@ -19,8 +19,6 @@ const API_PATH = "/api/data/v8.2/";
|
|||||||
const accessTokenEndpoint = process.env.ACCESS_TOKEN_ENDPOINT;
|
const accessTokenEndpoint = process.env.ACCESS_TOKEN_ENDPOINT;
|
||||||
const tenantId = process.env.TENANT;
|
const tenantId = process.env.TENANT;
|
||||||
|
|
||||||
//const WEBAPI_URL = "https://devcrm2016.llcdt.gov.wales/DVPINS" + API_PATH;
|
|
||||||
|
|
||||||
const WEBAPI_URL =
|
const WEBAPI_URL =
|
||||||
process.env.RELAY_ROOT ||
|
process.env.RELAY_ROOT ||
|
||||||
"https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/";
|
"https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/";
|
||||||
@@ -117,7 +115,7 @@ export const dehashString = (stringToDeHash) => {
|
|||||||
return dehashedStr.toString(CryptoJS.enc.Utf8);
|
return dehashedStr.toString(CryptoJS.enc.Utf8);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getBasicSearch = (token, searchString) => {
|
export const getBasicSearch = (searchString) => {
|
||||||
return axios
|
return axios
|
||||||
.get(
|
.get(
|
||||||
BASE_URL +
|
BASE_URL +
|
||||||
@@ -150,10 +148,7 @@ export const getBasicSearchPaged = (searchString, pageNumber) => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getBasicDNSSearch = (token, searchString) => {
|
export const getBasicDNSSearch = (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
|
return axios
|
||||||
.get(BASE_URL + "/api/endpoint/getbasicdnssearch_api")
|
.get(BASE_URL + "/api/endpoint/getbasicdnssearch_api")
|
||||||
.then((res) => res.data)
|
.then((res) => res.data)
|
||||||
@@ -173,7 +168,7 @@ export const getBasicDNSSearchPaged = (pageNumber) => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getAdvancedSearch = (token, searchString) => {
|
export const getAdvancedSearch = (searchString) => {
|
||||||
return axios
|
return axios
|
||||||
.get(
|
.get(
|
||||||
BASE_URL +
|
BASE_URL +
|
||||||
@@ -213,7 +208,6 @@ export const getAdvancedSearchPaged = (searchString, pageNumber) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const getBasicSearchDetails = (
|
export const getBasicSearchDetails = (
|
||||||
token,
|
|
||||||
appealTypeName,
|
appealTypeName,
|
||||||
caseReference,
|
caseReference,
|
||||||
primaryIdAttribute,
|
primaryIdAttribute,
|
||||||
@@ -299,23 +293,19 @@ export const getSearchDocumentHistory = (documentID) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const getSearchDocumentHistoryPaged = (documentID, pageNumber) => {
|
export const getSearchDocumentHistoryPaged = (documentID, pageNumber) => {
|
||||||
return (
|
return axios
|
||||||
axios
|
.get(
|
||||||
.get(
|
"/api/endpoint/getsearchdocumenthistorypaged_api?documentid=" +
|
||||||
"/api/endpoint/getsearchdocumenthistorypaged_api?documentid=" +
|
documentID +
|
||||||
documentID +
|
"&pageNumber=" +
|
||||||
"&pageNumber=" +
|
pageNumber
|
||||||
pageNumber
|
)
|
||||||
)
|
.then((res) => {
|
||||||
|
return res.data;
|
||||||
// .get(queryUrl + hashAPIPath(queryUrl))
|
})
|
||||||
.then((res) => {
|
.catch((error) => {
|
||||||
return res.data;
|
console.log("thiserror", error);
|
||||||
})
|
});
|
||||||
.catch((error) => {
|
|
||||||
console.log("thiserror", error);
|
|
||||||
})
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getLinkedCases = (parentIncidentid) => {
|
export const getLinkedCases = (parentIncidentid) => {
|
||||||
@@ -333,7 +323,7 @@ export const getLinkedCases = (parentIncidentid) => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getAppealsTypes = (token) => {
|
export const getAppealsTypes = () => {
|
||||||
return axios
|
return axios
|
||||||
.get(BASE_URL + "/api/endpoint/getappealtypes_api")
|
.get(BASE_URL + "/api/endpoint/getappealtypes_api")
|
||||||
.then((res) => res.data)
|
.then((res) => res.data)
|
||||||
@@ -349,7 +339,7 @@ export const getAppealsTypes = (token) => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getLPA = (token) => {
|
export const getLPA = () => {
|
||||||
return axios
|
return axios
|
||||||
.get(BASE_URL + "/api/endpoint/getlpa_api")
|
.get(BASE_URL + "/api/endpoint/getlpa_api")
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
@@ -369,7 +359,7 @@ export const getLPA = (token) => {
|
|||||||
|
|
||||||
// iteration 2 methods
|
// iteration 2 methods
|
||||||
|
|
||||||
export const getFormData = (token, whichForm) => {
|
export const getFormData = (whichForm) => {
|
||||||
return axios
|
return axios
|
||||||
.get("/api/endpoint/getformdata_api?whichForm=" + whichForm)
|
.get("/api/endpoint/getformdata_api?whichForm=" + whichForm)
|
||||||
.then((res) => res.data)
|
.then((res) => res.data)
|
||||||
@@ -378,7 +368,7 @@ export const getFormData = (token, whichForm) => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getMandatoryFields = (token, whichForm) => {
|
export const getMandatoryFields = (whichForm) => {
|
||||||
return axios
|
return axios
|
||||||
.get("/api/endpoint/getmandatoryfields_api?whichForm=" + whichForm)
|
.get("/api/endpoint/getmandatoryfields_api?whichForm=" + whichForm)
|
||||||
.then((res) => res.data)
|
.then((res) => res.data)
|
||||||
@@ -387,7 +377,7 @@ export const getMandatoryFields = (token, whichForm) => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getPickLists = (token, whichForm) => {
|
export const getPickLists = (whichForm) => {
|
||||||
return axios
|
return axios
|
||||||
.get("/api/endpoint/getpicklists_api?whichForm=" + whichForm)
|
.get("/api/endpoint/getpicklists_api?whichForm=" + whichForm)
|
||||||
.then((res) => res.data)
|
.then((res) => res.data)
|
||||||
@@ -396,7 +386,7 @@ export const getPickLists = (token, whichForm) => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getPersonalAccount = (token, contactid) => {
|
export const getPersonalAccount = (contactid) => {
|
||||||
return axios
|
return axios
|
||||||
.get("/api/endpoint/getpersonalaccount_api?contactid=" + contactid)
|
.get("/api/endpoint/getpersonalaccount_api?contactid=" + contactid)
|
||||||
.then((res) => {
|
.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);
|
appealTypeId = parseInt(appealTypeId);
|
||||||
|
|
||||||
var queryUrl = "incidents";
|
var queryUrl =
|
||||||
var data = JSON.stringify({
|
"/api/endpoint/createcase_api?appealTypeId=" +
|
||||||
"title": "insertion test case",
|
appealTypeId +
|
||||||
"caseorigincode": 3,
|
"&lpaID=" +
|
||||||
"customerid_contact@odata.bind": "/contacts(" + contactid + ")",
|
lpaID +
|
||||||
"pinswg_appealcasetype": appealTypeId,
|
"&contactid=" +
|
||||||
"pinswg_AssociatedLPA@odata.bind": "/accounts(" + lpaID + ")",
|
contactid;
|
||||||
});
|
|
||||||
|
|
||||||
var config = {
|
var config = {
|
||||||
method: "post",
|
method: "post",
|
||||||
url: WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
url: 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,
|
|
||||||
};
|
};
|
||||||
// console.log(config);
|
|
||||||
return axios(config)
|
return axios(config)
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
// console.log("posted ", res.data);
|
|
||||||
return res.data;
|
return res.data;
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
@@ -487,7 +466,7 @@ export const createCase = (token, appealTypeId, lpaID, contactid) => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getMyCases = (token, loggedInUserId) => {
|
export const getMyCases = (loggedInUserId) => {
|
||||||
return axios
|
return axios
|
||||||
.get(
|
.get(
|
||||||
BASE_URL +
|
BASE_URL +
|
||||||
@@ -502,7 +481,7 @@ export const getMyCases = (token, loggedInUserId) => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getMyRepresentations = (token, loggedInUserId) => {
|
export const getMyRepresentations = (loggedInUserId) => {
|
||||||
return axios
|
return axios
|
||||||
.get(
|
.get(
|
||||||
BASE_URL +
|
BASE_URL +
|
||||||
@@ -515,7 +494,7 @@ export const getMyRepresentations = (token, loggedInUserId) => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getMyRepresentationsProxy = (token, loggedInUserId) => {
|
export const getMyRepresentationsProxy = (loggedInUserId) => {
|
||||||
return axios
|
return axios
|
||||||
.get(
|
.get(
|
||||||
BASE_URL +
|
BASE_URL +
|
||||||
@@ -537,9 +516,8 @@ export const getRepresentations = (incidentID) => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getRepresentationsProxy = (token, incidentID) => {
|
export const getRepresentationsProxy = (incidentID) => {
|
||||||
return axios
|
return axios
|
||||||
.get(queryUrl + hashAPIPath(queryUrl))
|
|
||||||
.get(
|
.get(
|
||||||
BASE_URL +
|
BASE_URL +
|
||||||
"/api/endpoint/getrepresentationsproxy_api?incidentID=" +
|
"/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
|
return axios
|
||||||
.get(
|
.get(
|
||||||
BASE_URL +
|
BASE_URL +
|
||||||
@@ -564,7 +542,7 @@ export const getWatchedCases = (token, loggedInUserId) => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getWatchedCasesProxy = (token, loggedInUserId) => {
|
export const getWatchedCasesProxy = (loggedInUserId) => {
|
||||||
return axios
|
return axios
|
||||||
.get(
|
.get(
|
||||||
BASE_URL +
|
BASE_URL +
|
||||||
@@ -577,7 +555,7 @@ export const getWatchedCasesProxy = (token, loggedInUserId) => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getAwaitingSubmission = (token) => {
|
export const getAwaitingSubmission = () => {
|
||||||
return axios
|
return axios
|
||||||
.get(BASE_URL + "/api/lookups/awaitingSubmission", {
|
.get(BASE_URL + "/api/lookups/awaitingSubmission", {
|
||||||
httpsAgent: new https.Agent({ rejectUnauthorized: false }),
|
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
|
return axios
|
||||||
.get(
|
.get(
|
||||||
BASE_URL +
|
BASE_URL +
|
||||||
@@ -603,11 +581,7 @@ export const getPortalModuleDetails = (token, appealType, caseReference) => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getPortalModuleDetailsProxy = (
|
export const getPortalModuleDetailsProxy = (appealType, caseReference) => {
|
||||||
token,
|
|
||||||
appealType,
|
|
||||||
caseReference
|
|
||||||
) => {
|
|
||||||
return axios
|
return axios
|
||||||
.get(
|
.get(
|
||||||
BASE_URL +
|
BASE_URL +
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ import {
|
|||||||
getSearchDocumentHistory,
|
getSearchDocumentHistory,
|
||||||
getSearchDocumentHistoryPaged,
|
getSearchDocumentHistoryPaged,
|
||||||
getSearchDocumentDetailsPaged,
|
getSearchDocumentDetailsPaged,
|
||||||
getToken,
|
|
||||||
} from "../../actions";
|
} from "../../actions";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import { setCurrentReference } from "../../store/currentView/action";
|
|||||||
import { connect } from "react-redux";
|
import { connect } from "react-redux";
|
||||||
import { parseCookies } from "nookies";
|
import { parseCookies } from "nookies";
|
||||||
import {
|
import {
|
||||||
getToken,
|
|
||||||
getWatchedCasesProxy,
|
getWatchedCasesProxy,
|
||||||
getPortalModuleDetailsProxy,
|
getPortalModuleDetailsProxy,
|
||||||
deleteWatchedCases,
|
deleteWatchedCases,
|
||||||
@@ -37,26 +36,21 @@ const TopThree = (props) => {
|
|||||||
let showTopThreeArr = showTopThree.value;
|
let showTopThreeArr = showTopThree.value;
|
||||||
|
|
||||||
const deleteItem = (caseID, topThreeType) => {
|
const deleteItem = (caseID, topThreeType) => {
|
||||||
let token = getToken();
|
|
||||||
let cookies = parseCookies();
|
let cookies = parseCookies();
|
||||||
topThreeType == "watchedCases" &&
|
topThreeType == "watchedCases" &&
|
||||||
deleteWatchedCases(caseID)
|
deleteWatchedCases(caseID)
|
||||||
.then((data) => data)
|
.then((data) => data)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
getWatchedCasesProxy(token, cookies.pinsUser).then(
|
getWatchedCasesProxy(cookies.pinsUser).then((data) => {
|
||||||
(data) => {
|
setWatchedCases(data),
|
||||||
setWatchedCases(data),
|
getDetails(data, "myWatchedCases").then((data) => {
|
||||||
getDetails(token, data, "myWatchedCases").then(
|
setWatchedCasesDetails(data);
|
||||||
(data) => {
|
});
|
||||||
setWatchedCasesDetails(data);
|
});
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const getDetails = (token, resultsObj, detailsType) => {
|
const getDetails = (resultsObj, detailsType) => {
|
||||||
//console.log(resultsObj);
|
//console.log(resultsObj);
|
||||||
let detailsArr = [];
|
let detailsArr = [];
|
||||||
resultsObj = resultsObj.value;
|
resultsObj = resultsObj.value;
|
||||||
@@ -72,7 +66,6 @@ const TopThree = (props) => {
|
|||||||
} else {
|
} else {
|
||||||
detailsArr.push(
|
detailsArr.push(
|
||||||
getPortalModuleDetailsProxy(
|
getPortalModuleDetailsProxy(
|
||||||
token,
|
|
||||||
getFormCollectionByID(
|
getFormCollectionByID(
|
||||||
searchDetail.pinswg_appealcasetype
|
searchDetail.pinswg_appealcasetype
|
||||||
).LogicalCollectionName,
|
).LogicalCollectionName,
|
||||||
|
|||||||
@@ -39,7 +39,6 @@ import {
|
|||||||
|
|
||||||
import {
|
import {
|
||||||
createWatchedCases,
|
createWatchedCases,
|
||||||
getToken,
|
|
||||||
getWatchedCasesProxy,
|
getWatchedCasesProxy,
|
||||||
getPortalModuleDetailsProxy,
|
getPortalModuleDetailsProxy,
|
||||||
deleteWatchedCases,
|
deleteWatchedCases,
|
||||||
@@ -78,8 +77,6 @@ const SearchResults = (props) => {
|
|||||||
const cookies = parseCookies();
|
const cookies = parseCookies();
|
||||||
|
|
||||||
const selectWatchedCase = (loggedInUser, incidentID, appealType) => {
|
const selectWatchedCase = (loggedInUser, incidentID, appealType) => {
|
||||||
let token = getToken();
|
|
||||||
|
|
||||||
let updateBody = {
|
let updateBody = {
|
||||||
"pinswg_WatchedCase@odata.bind": "/incidents(" + incidentID + ")",
|
"pinswg_WatchedCase@odata.bind": "/incidents(" + incidentID + ")",
|
||||||
"pinswg_Contact@odata.bind": "/contacts(" + loggedInUser + ")",
|
"pinswg_Contact@odata.bind": "/contacts(" + loggedInUser + ")",
|
||||||
@@ -89,13 +86,11 @@ const SearchResults = (props) => {
|
|||||||
createWatchedCases(updateBody)
|
createWatchedCases(updateBody)
|
||||||
.then((data) => data)
|
.then((data) => data)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
getWatchedCasesProxy(token, cookies.pinsUser).then((data) => {
|
getWatchedCasesProxy(cookies.pinsUser).then((data) => {
|
||||||
setWatchedCases(data),
|
setWatchedCases(data),
|
||||||
getDetails(token, data, "myWatchedCases").then(
|
getDetails(data, "myWatchedCases").then((data) => {
|
||||||
(data) => {
|
setWatchedCasesDetails(data);
|
||||||
setWatchedCasesDetails(data);
|
});
|
||||||
}
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@@ -110,26 +105,21 @@ const SearchResults = (props) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const deleteItem = (caseID, topThreeType) => {
|
const deleteItem = (caseID, topThreeType) => {
|
||||||
let token = getToken();
|
|
||||||
let cookies = parseCookies();
|
let cookies = parseCookies();
|
||||||
topThreeType == "watchedCases" &&
|
topThreeType == "watchedCases" &&
|
||||||
deleteWatchedCases(caseID)
|
deleteWatchedCases(caseID)
|
||||||
.then((data) => data)
|
.then((data) => data)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
getWatchedCasesProxy(token, cookies.pinsUser).then(
|
getWatchedCasesProxy(cookies.pinsUser).then((data) => {
|
||||||
(data) => {
|
setWatchedCases(data),
|
||||||
setWatchedCases(data),
|
getDetails(data, "myWatchedCases").then((data) => {
|
||||||
getDetails(token, data, "myWatchedCases").then(
|
setWatchedCasesDetails(data);
|
||||||
(data) => {
|
});
|
||||||
setWatchedCasesDetails(data);
|
});
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const getDetails = (token, resultsObj, detailsType) => {
|
const getDetails = (resultsObj, detailsType) => {
|
||||||
//console.log(resultsObj);
|
//console.log(resultsObj);
|
||||||
let detailsArr = [];
|
let detailsArr = [];
|
||||||
resultsObj = resultsObj.value;
|
resultsObj = resultsObj.value;
|
||||||
@@ -145,7 +135,6 @@ const SearchResults = (props) => {
|
|||||||
} else {
|
} else {
|
||||||
detailsArr.push(
|
detailsArr.push(
|
||||||
getPortalModuleDetailsProxy(
|
getPortalModuleDetailsProxy(
|
||||||
token,
|
|
||||||
getFormCollectionByID(
|
getFormCollectionByID(
|
||||||
searchDetail.pinswg_appealcasetype
|
searchDetail.pinswg_appealcasetype
|
||||||
).LogicalCollectionName,
|
).LogicalCollectionName,
|
||||||
|
|||||||
@@ -27,10 +27,9 @@ export const getFormCollectionByID = (appealTypeID) => {
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Get the details of a case from the appeal type
|
* Get the details of a case from the appeal type
|
||||||
* @param String token
|
|
||||||
* @param object searchResultsObj
|
* @param object searchResultsObj
|
||||||
*/
|
*/
|
||||||
export const getSearchDetails = (token, searchResultsObj) => {
|
export const getSearchDetails = (searchResultsObj) => {
|
||||||
//console.log(searchResultsObj);
|
//console.log(searchResultsObj);
|
||||||
|
|
||||||
let detailsArr = [];
|
let detailsArr = [];
|
||||||
@@ -45,7 +44,6 @@ export const getSearchDetails = (token, searchResultsObj) => {
|
|||||||
//console.log(formMeta);
|
//console.log(formMeta);
|
||||||
detailsArr.push(
|
detailsArr.push(
|
||||||
getBasicSearchDetails(
|
getBasicSearchDetails(
|
||||||
token,
|
|
||||||
formMeta.LogicalCollectionName,
|
formMeta.LogicalCollectionName,
|
||||||
searchDetail.title,
|
searchDetail.title,
|
||||||
formMeta.PrimaryIdAttribute,
|
formMeta.PrimaryIdAttribute,
|
||||||
|
|||||||
+2
-20
@@ -139,27 +139,9 @@ const Home = (props) => {
|
|||||||
export const getServerSideProps = wrapper.getServerSideProps(
|
export const getServerSideProps = wrapper.getServerSideProps(
|
||||||
(store) =>
|
(store) =>
|
||||||
async ({ query, req, res }) => {
|
async ({ query, req, res }) => {
|
||||||
let token = await getToken();
|
|
||||||
|
|
||||||
var tokenIssuedAt = new Date();
|
|
||||||
var tokenExpiryTimeAt = new Date();
|
|
||||||
tokenExpiryTimeAt.setSeconds(
|
|
||||||
tokenExpiryTimeAt.getSeconds() + token.expires_in
|
|
||||||
);
|
|
||||||
|
|
||||||
// console.log(
|
|
||||||
// "token issued:",
|
|
||||||
// tokenIssuedAt.toUTCString(),
|
|
||||||
// "\n",
|
|
||||||
// "token expires:",
|
|
||||||
// tokenExpiryTimeAt.toUTCString()
|
|
||||||
// );
|
|
||||||
// console.log(token);
|
|
||||||
token = token.access_token;
|
|
||||||
|
|
||||||
const [appealTypeData, lpaData] = await Promise.all([
|
const [appealTypeData, lpaData] = await Promise.all([
|
||||||
await getAppealsTypes(token),
|
await getAppealsTypes(),
|
||||||
await getLPA(token),
|
await getLPA(),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
store.dispatch(setAppealType(appealTypeData));
|
store.dispatch(setAppealType(appealTypeData));
|
||||||
|
|||||||
@@ -123,14 +123,8 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
|||||||
console.log("query-", query);
|
console.log("query-", query);
|
||||||
//console.log("search array:", Object.entries(query));
|
//console.log("search array:", Object.entries(query));
|
||||||
|
|
||||||
let token = await getToken();
|
const searchResultsObj = await getAdvancedSearch(query);
|
||||||
token = token.access_token;
|
const searchDetailsObj = await getSearchDetails(searchResultsObj);
|
||||||
|
|
||||||
const searchResultsObj = await getAdvancedSearch(token, query);
|
|
||||||
const searchDetailsObj = await getSearchDetails(
|
|
||||||
token,
|
|
||||||
searchResultsObj
|
|
||||||
);
|
|
||||||
|
|
||||||
store.dispatch(setSearchResults(searchResultsObj));
|
store.dispatch(setSearchResults(searchResultsObj));
|
||||||
store.dispatch(setSearchDetails(searchDetailsObj));
|
store.dispatch(setSearchDetails(searchDetailsObj));
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import axios from "axios";
|
|||||||
import https from "https";
|
import https from "https";
|
||||||
import CryptoJS from "crypto-js";
|
import CryptoJS from "crypto-js";
|
||||||
import { getToken, azureHeadersPaged } from "../../../actions";
|
import { getToken, azureHeadersPaged } from "../../../actions";
|
||||||
|
|
||||||
const WORDKEY = process.env.HASHKEY;
|
const WORDKEY = process.env.HASHKEY;
|
||||||
|
|
||||||
const WEBAPI_URL =
|
const WEBAPI_URL =
|
||||||
@@ -41,7 +42,6 @@ export default async function ApiProxy(req, res) {
|
|||||||
|
|
||||||
return axios(config)
|
return axios(config)
|
||||||
.then(({ data }) => {
|
.then(({ data }) => {
|
||||||
console.log("deleted ");
|
|
||||||
res.status(200).json(data);
|
res.status(200).json(data);
|
||||||
})
|
})
|
||||||
.catch(({ err }) => {
|
.catch(({ err }) => {
|
||||||
|
|||||||
@@ -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 https from "https";
|
||||||
import CryptoJS from "crypto-js";
|
import CryptoJS from "crypto-js";
|
||||||
import { getToken, azureHeadersPaged } from "../../../actions";
|
import { getToken, azureHeadersPaged } from "../../../actions";
|
||||||
|
|
||||||
const WORDKEY = process.env.HASHKEY;
|
const WORDKEY = process.env.HASHKEY;
|
||||||
|
|
||||||
const WEBAPI_URL =
|
const WEBAPI_URL =
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import axios from "axios";
|
|||||||
import https from "https";
|
import https from "https";
|
||||||
import CryptoJS from "crypto-js";
|
import CryptoJS from "crypto-js";
|
||||||
import { getToken, azureHeadersPaged } from "../../../actions";
|
import { getToken, azureHeadersPaged } from "../../../actions";
|
||||||
|
|
||||||
const WORDKEY = process.env.HASHKEY;
|
const WORDKEY = process.env.HASHKEY;
|
||||||
|
|
||||||
const WEBAPI_URL =
|
const WEBAPI_URL =
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import axios from "axios";
|
|||||||
import https from "https";
|
import https from "https";
|
||||||
import CryptoJS from "crypto-js";
|
import CryptoJS from "crypto-js";
|
||||||
import { getToken, azureHeadersPaged } from "../../../actions";
|
import { getToken, azureHeadersPaged } from "../../../actions";
|
||||||
|
|
||||||
const WORDKEY = process.env.HASHKEY;
|
const WORDKEY = process.env.HASHKEY;
|
||||||
|
|
||||||
const WEBAPI_URL =
|
const WEBAPI_URL =
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import https from "https";
|
import https from "https";
|
||||||
import CryptoJS from "crypto-js";
|
import CryptoJS from "crypto-js";
|
||||||
|
import _ from "lodash";
|
||||||
import { getToken, azureHeadersPaged } from "../../../actions";
|
import { getToken, azureHeadersPaged } from "../../../actions";
|
||||||
|
|
||||||
const WORDKEY = process.env.HASHKEY;
|
const WORDKEY = process.env.HASHKEY;
|
||||||
|
|
||||||
const WEBAPI_URL =
|
const WEBAPI_URL =
|
||||||
@@ -24,12 +26,14 @@ export default async function ApiProxy(req, res) {
|
|||||||
var searchString = req.query.searchstring;
|
var searchString = req.query.searchstring;
|
||||||
var token = await getToken();
|
var token = await getToken();
|
||||||
|
|
||||||
searchString = JSON.parse(searchString);
|
searchString = _.isEmpty(searchString)
|
||||||
|
? searchString
|
||||||
|
: JSON.parse(decodeURI(searchString));
|
||||||
|
|
||||||
var queryString = "";
|
var queryString = "";
|
||||||
|
|
||||||
queryString +=
|
queryString +=
|
||||||
searchString.q != null
|
_.has(searchString, "q") && searchString.q != null
|
||||||
? "(contains(title, '" +
|
? "(contains(title, '" +
|
||||||
searchString.q +
|
searchString.q +
|
||||||
"') or contains(ticketnumber,'" +
|
"') or contains(ticketnumber,'" +
|
||||||
@@ -38,13 +42,13 @@ export default async function ApiProxy(req, res) {
|
|||||||
: "";
|
: "";
|
||||||
|
|
||||||
queryString +=
|
queryString +=
|
||||||
searchString.lpa != null
|
_.has(searchString, "lpa") && searchString.lpa != null
|
||||||
? (typeof searchString.q == "undefined" ? "" : " and ") +
|
? (typeof searchString.q == "undefined" ? "" : " and ") +
|
||||||
"_pinswg_associatedlpa_value eq " +
|
"_pinswg_associatedlpa_value eq " +
|
||||||
searchString.lpa
|
searchString.lpa
|
||||||
: "";
|
: "";
|
||||||
queryString +=
|
queryString +=
|
||||||
searchString.apt != null
|
_.has(searchString, "apt") && searchString.apt != null
|
||||||
? (typeof searchString.q == "undefined" &&
|
? (typeof searchString.q == "undefined" &&
|
||||||
typeof searchString.lpa == "undefined"
|
typeof searchString.lpa == "undefined"
|
||||||
? ""
|
? ""
|
||||||
@@ -58,15 +62,23 @@ export default async function ApiProxy(req, res) {
|
|||||||
queryString +
|
queryString +
|
||||||
" and pinswg_appealcasetype ne null and pinswg_publishtoweb eq true&$orderby=createdon desc&$count=true";
|
" and pinswg_appealcasetype ne null and pinswg_publishtoweb eq true&$orderby=createdon desc&$count=true";
|
||||||
|
|
||||||
return axios
|
var apiResponse = _.isEmpty(searchString)
|
||||||
.get(
|
? res.status(400).json()
|
||||||
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
: axios
|
||||||
azureHeadersPaged(token.access_token)
|
.get(
|
||||||
)
|
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
||||||
.then(({ data }) => {
|
azureHeadersPaged(token.access_token)
|
||||||
res.status(200).json(data);
|
)
|
||||||
})
|
.then(({ data }) => {
|
||||||
.catch(({ err }) => {
|
var dataStr;
|
||||||
res.status(400).json(err);
|
_.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 pageNumber = req.query.pageNumber;
|
||||||
var token = await getToken();
|
var token = await getToken();
|
||||||
|
|
||||||
searchString = JSON.parse(searchString);
|
searchString = _.isEmpty(searchString)
|
||||||
|
? searchString
|
||||||
|
: JSON.parse(decodeURI(searchString));
|
||||||
|
|
||||||
var queryString = "";
|
var queryString = "";
|
||||||
|
|
||||||
queryString +=
|
queryString +=
|
||||||
searchString.q != null
|
_.has(searchString, "q") && searchString.q != null
|
||||||
? "(contains(title, '" +
|
? "(contains(title, '" +
|
||||||
searchString.q +
|
searchString.q +
|
||||||
"') or contains(ticketnumber,'" +
|
"') or contains(ticketnumber,'" +
|
||||||
@@ -41,13 +43,13 @@ export default async function ApiProxy(req, res) {
|
|||||||
: "";
|
: "";
|
||||||
|
|
||||||
queryString +=
|
queryString +=
|
||||||
searchString.lpa != null
|
_.has(searchString, "lpa") && searchString.lpa != null
|
||||||
? (typeof searchString.q == "undefined" ? "" : " and ") +
|
? (typeof searchString.q == "undefined" ? "" : " and ") +
|
||||||
"_pinswg_associatedlpa_value eq " +
|
"_pinswg_associatedlpa_value eq " +
|
||||||
searchString.lpa
|
searchString.lpa
|
||||||
: "";
|
: "";
|
||||||
queryString +=
|
queryString +=
|
||||||
searchString.apt != null
|
_.has(searchString, "apt") && searchString.apt != null
|
||||||
? (typeof searchString.q == "undefined" &&
|
? (typeof searchString.q == "undefined" &&
|
||||||
typeof searchString.lpa == "undefined"
|
typeof searchString.lpa == "undefined"
|
||||||
? ""
|
? ""
|
||||||
@@ -64,19 +66,23 @@ export default async function ApiProxy(req, res) {
|
|||||||
? "&$skiptoken=" + ('<cookie pagenumber="' + pageNumber + '" />')
|
? "&$skiptoken=" + ('<cookie pagenumber="' + pageNumber + '" />')
|
||||||
: "");
|
: "");
|
||||||
|
|
||||||
return axios
|
var apiResponse = _.isEmpty(searchString)
|
||||||
.get(
|
? res.status(400).json()
|
||||||
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
: axios
|
||||||
azureHeadersPaged(token.access_token)
|
.get(
|
||||||
)
|
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
||||||
.then(({ data }) => {
|
azureHeadersPaged(token.access_token)
|
||||||
var dataStr;
|
)
|
||||||
_.has(data, "@odata.nextLink") == true &&
|
.then(({ data }) => {
|
||||||
((dataStr = JSON.stringify(data["@odata.nextLink"])),
|
var dataStr;
|
||||||
(data["@odata.nextLink"] = dataStr.split("/v8.2/")[1]));
|
_.has(data, "@odata.nextLink") == true &&
|
||||||
res.status(200).json(data);
|
((dataStr = JSON.stringify(data["@odata.nextLink"])),
|
||||||
})
|
(data["@odata.nextLink"] = dataStr.split("/v8.2/")[1]));
|
||||||
.catch(({ err }) => {
|
res.status(200).json(data);
|
||||||
res.status(400).json(err);
|
})
|
||||||
});
|
.catch(({ err }) => {
|
||||||
|
res.status(400).json(err);
|
||||||
|
});
|
||||||
|
|
||||||
|
return apiResponse;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import axios from "axios";
|
|||||||
import https from "https";
|
import https from "https";
|
||||||
import CryptoJS from "crypto-js";
|
import CryptoJS from "crypto-js";
|
||||||
import { getToken, azureHeaders } from "../../../actions";
|
import { getToken, azureHeaders } from "../../../actions";
|
||||||
|
|
||||||
const WORDKEY = process.env.HASHKEY;
|
const WORDKEY = process.env.HASHKEY;
|
||||||
|
|
||||||
const WEBAPI_URL =
|
const WEBAPI_URL =
|
||||||
|
|||||||
@@ -2,6 +2,17 @@ import axios from "axios";
|
|||||||
import https from "https";
|
import https from "https";
|
||||||
import CryptoJS from "crypto-js";
|
import CryptoJS from "crypto-js";
|
||||||
import { getToken, azureHeadersPaged, azureHeaders } from "../../../actions";
|
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 WORDKEY = process.env.HASHKEY;
|
||||||
|
|
||||||
const WEBAPI_URL =
|
const WEBAPI_URL =
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import https from "https";
|
import https from "https";
|
||||||
import CryptoJS from "crypto-js";
|
import CryptoJS from "crypto-js";
|
||||||
|
import _ from "lodash";
|
||||||
import { getToken, azureHeaders, azureHeadersPaged } from "../../../actions";
|
import { getToken, azureHeaders, azureHeadersPaged } from "../../../actions";
|
||||||
|
|
||||||
const WORDKEY = process.env.HASHKEY;
|
const WORDKEY = process.env.HASHKEY;
|
||||||
@@ -33,6 +34,10 @@ export default async function ApiProxy(req, res) {
|
|||||||
azureHeadersPaged(token.access_token)
|
azureHeadersPaged(token.access_token)
|
||||||
)
|
)
|
||||||
.then(({ data }) => {
|
.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);
|
res.status(200).json(data);
|
||||||
})
|
})
|
||||||
.catch(({ err }) => {
|
.catch(({ err }) => {
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import https from "https";
|
import https from "https";
|
||||||
import CryptoJS from "crypto-js";
|
import CryptoJS from "crypto-js";
|
||||||
|
import _ from "lodash";
|
||||||
import { getToken, azureHeadersPaged } from "../../../actions";
|
import { getToken, azureHeadersPaged } from "../../../actions";
|
||||||
|
|
||||||
const WORDKEY = process.env.HASHKEY;
|
const WORDKEY = process.env.HASHKEY;
|
||||||
|
|
||||||
const WEBAPI_URL =
|
const WEBAPI_URL =
|
||||||
@@ -29,15 +31,21 @@ export default async function ApiProxy(req, res) {
|
|||||||
caseReference +
|
caseReference +
|
||||||
"'&$count=true";
|
"'&$count=true";
|
||||||
|
|
||||||
return axios
|
var apiResponse = _.isEmpty(req.query)
|
||||||
.get(
|
? res.status(400).json()
|
||||||
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
: typeof caseReference != "undefined" && caseReference.length > 0
|
||||||
azureHeaders(token.access_token)
|
? axios
|
||||||
)
|
.get(
|
||||||
.then(({ data }) => {
|
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
||||||
res.status(200).json(data);
|
azureHeaders(token.access_token)
|
||||||
})
|
)
|
||||||
.catch(({ err }) => {
|
.then(({ data }) => {
|
||||||
res.status(400).json(err);
|
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 +
|
caseReference +
|
||||||
"'&$count=true";
|
"'&$count=true";
|
||||||
|
|
||||||
return axios
|
var apiResponse = _.isEmpty(req.query)
|
||||||
.get(
|
? res.status(400).json()
|
||||||
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
: typeof caseReference != "undefined" && caseReference.length > 0
|
||||||
azureHeadersPaged(token.access_token)
|
? axios
|
||||||
)
|
.get(
|
||||||
.then(({ data }) => {
|
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
||||||
var dataStr;
|
azureHeadersPaged(token.access_token)
|
||||||
_.has(data, "@odata.nextLink") == true &&
|
)
|
||||||
((dataStr = JSON.stringify(data["@odata.nextLink"])),
|
.then(({ data }) => {
|
||||||
(data["@odata.nextLink"] = dataStr.split("/v8.2/")[1]));
|
var dataStr;
|
||||||
return res.status(200).json(data);
|
_.has(data, "@odata.nextLink") == true &&
|
||||||
})
|
((dataStr = JSON.stringify(data["@odata.nextLink"])),
|
||||||
.catch(({ err }) => {
|
(data["@odata.nextLink"] = dataStr.split("/v8.2/")[1]));
|
||||||
res.status(400).json(err);
|
return res.status(200).json(data);
|
||||||
});
|
})
|
||||||
|
.catch(({ err }) => {
|
||||||
|
res.status(400).json(err);
|
||||||
|
})
|
||||||
|
: res.status(400).json();
|
||||||
|
|
||||||
|
return apiResponse;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import https from "https";
|
import https from "https";
|
||||||
import CryptoJS from "crypto-js";
|
import CryptoJS from "crypto-js";
|
||||||
|
import _ from "lodash";
|
||||||
import { getToken, azureHeadersPaged } from "../../../actions";
|
import { getToken, azureHeadersPaged } from "../../../actions";
|
||||||
|
|
||||||
const WORDKEY = process.env.HASHKEY;
|
const WORDKEY = process.env.HASHKEY;
|
||||||
|
|
||||||
const WEBAPI_URL =
|
const WEBAPI_URL =
|
||||||
@@ -31,15 +33,25 @@ export default async function ApiProxy(req, res) {
|
|||||||
searchString +
|
searchString +
|
||||||
"')) and pinswg_appealcasetype ne null and pinswg_publishtoweb eq true&$orderby=createdon desc&$count=true";
|
"')) and pinswg_appealcasetype ne null and pinswg_publishtoweb eq true&$orderby=createdon desc&$count=true";
|
||||||
|
|
||||||
return axios
|
var apiResponse = _.isEmpty(req.query)
|
||||||
.get(
|
? res.status(400).json()
|
||||||
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
: searchString.length > 0
|
||||||
azureHeadersPaged(token.access_token)
|
? axios
|
||||||
)
|
.get(
|
||||||
.then(({ data }) => {
|
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
||||||
res.status(200).json(data);
|
azureHeadersPaged(token.access_token)
|
||||||
})
|
)
|
||||||
.catch(({ err }) => {
|
.then(({ data }) => {
|
||||||
res.status(400).json(err);
|
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 https from "https";
|
||||||
import CryptoJS from "crypto-js";
|
import CryptoJS from "crypto-js";
|
||||||
import { getToken, azureHeaders } from "../../../actions";
|
import { getToken, azureHeaders } from "../../../actions";
|
||||||
|
|
||||||
const WORDKEY = process.env.HASHKEY;
|
const WORDKEY = process.env.HASHKEY;
|
||||||
|
|
||||||
const WEBAPI_URL =
|
const WEBAPI_URL =
|
||||||
|
|||||||
@@ -35,19 +35,25 @@ export default async function ApiProxy(req, res) {
|
|||||||
? "&$skiptoken=" + '<cookie pagenumber="' + pageNumber + '" />'
|
? "&$skiptoken=" + '<cookie pagenumber="' + pageNumber + '" />'
|
||||||
: "");
|
: "");
|
||||||
|
|
||||||
return axios
|
var apiResponse =
|
||||||
.get(
|
searchString.length > 0
|
||||||
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
? axios
|
||||||
azureHeadersPaged(token.access_token)
|
.get(
|
||||||
)
|
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
||||||
.then(({ data }) => {
|
azureHeadersPaged(token.access_token)
|
||||||
var dataStr;
|
)
|
||||||
_.has(data, "@odata.nextLink") == true &&
|
.then(({ data }) => {
|
||||||
((dataStr = JSON.stringify(data["@odata.nextLink"])),
|
var dataStr;
|
||||||
(data["@odata.nextLink"] = dataStr.split("/v8.2/")[1]));
|
_.has(data, "@odata.nextLink") == true &&
|
||||||
return res.status(200).json(data);
|
((dataStr = JSON.stringify(data["@odata.nextLink"])),
|
||||||
})
|
(data["@odata.nextLink"] =
|
||||||
.catch(({ err }) => {
|
dataStr.split("/v8.2/")[1]));
|
||||||
res.status(400).json(err);
|
res.status(200).json(data);
|
||||||
});
|
})
|
||||||
|
.catch(({ err }) => {
|
||||||
|
res.status(400).json(err);
|
||||||
|
})
|
||||||
|
: res.status(400).json();
|
||||||
|
|
||||||
|
return apiResponse;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import https from "https";
|
import https from "https";
|
||||||
import CryptoJS from "crypto-js";
|
import CryptoJS from "crypto-js";
|
||||||
|
import _ from "lodash";
|
||||||
import { getToken, azureHeaders } from "../../../actions";
|
import { getToken, azureHeaders } from "../../../actions";
|
||||||
|
|
||||||
const WORDKEY = process.env.HASHKEY;
|
const WORDKEY = process.env.HASHKEY;
|
||||||
|
|
||||||
const WEBAPI_URL =
|
const WEBAPI_URL =
|
||||||
@@ -26,15 +28,21 @@ export default async function ApiProxy(req, res) {
|
|||||||
emailAddress +
|
emailAddress +
|
||||||
"'&$count=true&$select=emailaddress1, contactid";
|
"'&$count=true&$select=emailaddress1, contactid";
|
||||||
|
|
||||||
return axios
|
var apiResponse = _.isEmpty(req.query)
|
||||||
.get(
|
? res.status(400).json()
|
||||||
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
: typeof emailAddress != "undefined" && emailAddress.length > 0
|
||||||
azureHeaders(token.access_token)
|
? axios
|
||||||
)
|
.get(
|
||||||
.then(({ data }) => {
|
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
||||||
res.status(200).json(data);
|
azureHeaders(token.access_token)
|
||||||
})
|
)
|
||||||
.catch(({ err }) => {
|
.then(({ data }) => {
|
||||||
res.status(400).json(err);
|
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 https from "https";
|
||||||
import CryptoJS from "crypto-js";
|
import CryptoJS from "crypto-js";
|
||||||
import { getToken, azureHeadersPaged, azureHeaders } from "../../../actions";
|
import { getToken, azureHeadersPaged, azureHeaders } from "../../../actions";
|
||||||
|
|
||||||
const WORDKEY = process.env.HASHKEY;
|
const WORDKEY = process.env.HASHKEY;
|
||||||
|
|
||||||
const WEBAPI_URL =
|
const WEBAPI_URL =
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import https from "https";
|
import https from "https";
|
||||||
import CryptoJS from "crypto-js";
|
import CryptoJS from "crypto-js";
|
||||||
|
import _ from "lodash";
|
||||||
import { getToken, azureHeadersPaged } from "../../../actions";
|
import { getToken, azureHeadersPaged } from "../../../actions";
|
||||||
|
|
||||||
const WORDKEY = process.env.HASHKEY;
|
const WORDKEY = process.env.HASHKEY;
|
||||||
|
|
||||||
const WEBAPI_URL =
|
const WEBAPI_URL =
|
||||||
@@ -29,15 +31,26 @@ export default async function ApiProxy(req, res) {
|
|||||||
pwd +
|
pwd +
|
||||||
"'&$count=true&$select=emailaddress1,contactid,pinswg_custom_password,yomifullname,firstname,lastname";
|
"'&$count=true&$select=emailaddress1,contactid,pinswg_custom_password,yomifullname,firstname,lastname";
|
||||||
|
|
||||||
return axios
|
console.log(_.isEmpty(req.query));
|
||||||
.get(
|
|
||||||
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
var apiResponse = _.isEmpty(req.query)
|
||||||
azureHeadersPaged(token.access_token)
|
? res.status(400).json()
|
||||||
)
|
: typeof emailAddress != "undefined" &&
|
||||||
.then(({ data }) => {
|
emailAddress.length > 0 &&
|
||||||
res.status(200).json(data);
|
typeof pwd != "undefined" &&
|
||||||
})
|
pwd.length > 0
|
||||||
.catch(({ err }) => {
|
? axios
|
||||||
res.status(400).json(err);
|
.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;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import axios from "axios";
|
|||||||
import https from "https";
|
import https from "https";
|
||||||
import CryptoJS from "crypto-js";
|
import CryptoJS from "crypto-js";
|
||||||
import { getToken, azureHeadersPaged, azureHeaders } from "../../../actions";
|
import { getToken, azureHeadersPaged, azureHeaders } from "../../../actions";
|
||||||
|
|
||||||
const WORDKEY = process.env.HASHKEY;
|
const WORDKEY = process.env.HASHKEY;
|
||||||
|
|
||||||
const WEBAPI_URL =
|
const WEBAPI_URL =
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import axios from "axios";
|
|||||||
import https from "https";
|
import https from "https";
|
||||||
import CryptoJS from "crypto-js";
|
import CryptoJS from "crypto-js";
|
||||||
import { getToken, azureHeadersPaged, azureHeaders } from "../../../actions";
|
import { getToken, azureHeadersPaged, azureHeaders } from "../../../actions";
|
||||||
|
|
||||||
const WORDKEY = process.env.HASHKEY;
|
const WORDKEY = process.env.HASHKEY;
|
||||||
|
|
||||||
const WEBAPI_URL =
|
const WEBAPI_URL =
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import axios from "axios";
|
|||||||
import https from "https";
|
import https from "https";
|
||||||
import CryptoJS from "crypto-js";
|
import CryptoJS from "crypto-js";
|
||||||
import { getToken, azureHeaders } from "../../../actions";
|
import { getToken, azureHeaders } from "../../../actions";
|
||||||
|
|
||||||
const WORDKEY = process.env.HASHKEY;
|
const WORDKEY = process.env.HASHKEY;
|
||||||
|
|
||||||
const WEBAPI_URL =
|
const WEBAPI_URL =
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import axios from "axios";
|
|||||||
import https from "https";
|
import https from "https";
|
||||||
import CryptoJS from "crypto-js";
|
import CryptoJS from "crypto-js";
|
||||||
import { getToken, azureHeaders } from "../../../actions";
|
import { getToken, azureHeaders } from "../../../actions";
|
||||||
|
|
||||||
const WORDKEY = process.env.HASHKEY;
|
const WORDKEY = process.env.HASHKEY;
|
||||||
|
|
||||||
const WEBAPI_URL =
|
const WEBAPI_URL =
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import axios from "axios";
|
|||||||
import https from "https";
|
import https from "https";
|
||||||
import CryptoJS from "crypto-js";
|
import CryptoJS from "crypto-js";
|
||||||
import { getToken, azureHeaders } from "../../../actions";
|
import { getToken, azureHeaders } from "../../../actions";
|
||||||
|
|
||||||
const WORDKEY = process.env.HASHKEY;
|
const WORDKEY = process.env.HASHKEY;
|
||||||
|
|
||||||
const WEBAPI_URL =
|
const WEBAPI_URL =
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import axios from "axios";
|
|||||||
import https from "https";
|
import https from "https";
|
||||||
import CryptoJS from "crypto-js";
|
import CryptoJS from "crypto-js";
|
||||||
import { getToken, azureHeaders } from "../../../actions";
|
import { getToken, azureHeaders } from "../../../actions";
|
||||||
|
|
||||||
const WORDKEY = process.env.HASHKEY;
|
const WORDKEY = process.env.HASHKEY;
|
||||||
|
|
||||||
const WEBAPI_URL =
|
const WEBAPI_URL =
|
||||||
@@ -20,21 +21,27 @@ const hashAPIPath = (queryPath) => {
|
|||||||
export default async function ApiProxy(req, res) {
|
export default async function ApiProxy(req, res) {
|
||||||
var contactid = req.query.contactid;
|
var contactid = req.query.contactid;
|
||||||
var token = await getToken();
|
var token = await getToken();
|
||||||
|
console.log(" eeee", contactid.length);
|
||||||
|
|
||||||
var queryUrl =
|
var queryUrl =
|
||||||
"contacts(" +
|
"contacts(" +
|
||||||
contactid +
|
contactid +
|
||||||
")?$select=firstname, lastname, emailaddress1, telephone1, company, address1_line1,address1_line2,address1_city, address1_county,address1_postalcode&$count=true";
|
")?$select=firstname, lastname, emailaddress1, telephone1, company, address1_line1,address1_line2,address1_city, address1_county,address1_postalcode&$count=true";
|
||||||
|
|
||||||
return axios
|
var apiResponse =
|
||||||
.get(
|
contactid.length > 0
|
||||||
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
? axios
|
||||||
azureHeaders(token.access_token)
|
.get(
|
||||||
)
|
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
||||||
.then(({ data }) => {
|
azureHeaders(token.access_token)
|
||||||
res.status(200).json(data);
|
)
|
||||||
})
|
.then(({ data }) => {
|
||||||
.catch(({ err }) => {
|
res.status(200).json(data);
|
||||||
res.status(400).json(err);
|
})
|
||||||
});
|
.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 https from "https";
|
||||||
import CryptoJS from "crypto-js";
|
import CryptoJS from "crypto-js";
|
||||||
import { getToken, azureHeaders } from "../../../actions";
|
import { getToken, azureHeaders } from "../../../actions";
|
||||||
|
|
||||||
const WORDKEY = process.env.HASHKEY;
|
const WORDKEY = process.env.HASHKEY;
|
||||||
|
|
||||||
const WEBAPI_URL =
|
const WEBAPI_URL =
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import axios from "axios";
|
|||||||
import https from "https";
|
import https from "https";
|
||||||
import CryptoJS from "crypto-js";
|
import CryptoJS from "crypto-js";
|
||||||
import { getToken, azureHeaders } from "../../../actions";
|
import { getToken, azureHeaders } from "../../../actions";
|
||||||
|
|
||||||
const WORDKEY = process.env.HASHKEY;
|
const WORDKEY = process.env.HASHKEY;
|
||||||
|
|
||||||
const WEBAPI_URL =
|
const WEBAPI_URL =
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import axios from "axios";
|
|||||||
import https from "https";
|
import https from "https";
|
||||||
import CryptoJS from "crypto-js";
|
import CryptoJS from "crypto-js";
|
||||||
import { getToken, azureHeaders } from "../../../actions";
|
import { getToken, azureHeaders } from "../../../actions";
|
||||||
|
|
||||||
const WORDKEY = process.env.HASHKEY;
|
const WORDKEY = process.env.HASHKEY;
|
||||||
|
|
||||||
const WEBAPI_URL =
|
const WEBAPI_URL =
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import axios from "axios";
|
|||||||
import https from "https";
|
import https from "https";
|
||||||
import CryptoJS from "crypto-js";
|
import CryptoJS from "crypto-js";
|
||||||
import { getToken, azureHeaders } from "../../../actions";
|
import { getToken, azureHeaders } from "../../../actions";
|
||||||
|
|
||||||
const WORDKEY = process.env.HASHKEY;
|
const WORDKEY = process.env.HASHKEY;
|
||||||
|
|
||||||
const WEBAPI_URL =
|
const WEBAPI_URL =
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import axios from "axios";
|
|||||||
import https from "https";
|
import https from "https";
|
||||||
import CryptoJS from "crypto-js";
|
import CryptoJS from "crypto-js";
|
||||||
import { getToken, azureHeaders } from "../../../actions";
|
import { getToken, azureHeaders } from "../../../actions";
|
||||||
|
|
||||||
const WORDKEY = process.env.HASHKEY;
|
const WORDKEY = process.env.HASHKEY;
|
||||||
|
|
||||||
const WEBAPI_URL =
|
const WEBAPI_URL =
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import axios from "axios";
|
|||||||
import https from "https";
|
import https from "https";
|
||||||
import CryptoJS from "crypto-js";
|
import CryptoJS from "crypto-js";
|
||||||
import { getToken, azureHeaders } from "../../../actions";
|
import { getToken, azureHeaders } from "../../../actions";
|
||||||
|
|
||||||
const WORDKEY = process.env.HASHKEY;
|
const WORDKEY = process.env.HASHKEY;
|
||||||
|
|
||||||
const WEBAPI_URL =
|
const WEBAPI_URL =
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import axios from "axios";
|
|||||||
import https from "https";
|
import https from "https";
|
||||||
import CryptoJS from "crypto-js";
|
import CryptoJS from "crypto-js";
|
||||||
import { getToken, azureHeaders } from "../../../actions";
|
import { getToken, azureHeaders } from "../../../actions";
|
||||||
|
|
||||||
const WORDKEY = process.env.HASHKEY;
|
const WORDKEY = process.env.HASHKEY;
|
||||||
|
|
||||||
const WEBAPI_URL =
|
const WEBAPI_URL =
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import axios from "axios";
|
|||||||
import https from "https";
|
import https from "https";
|
||||||
import CryptoJS from "crypto-js";
|
import CryptoJS from "crypto-js";
|
||||||
import { getToken, azureHeaders } from "../../../actions";
|
import { getToken, azureHeaders } from "../../../actions";
|
||||||
|
|
||||||
const WORDKEY = process.env.HASHKEY;
|
const WORDKEY = process.env.HASHKEY;
|
||||||
|
|
||||||
const WEBAPI_URL =
|
const WEBAPI_URL =
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import axios from "axios";
|
|||||||
import https from "https";
|
import https from "https";
|
||||||
import CryptoJS from "crypto-js";
|
import CryptoJS from "crypto-js";
|
||||||
import { getToken, azureHeadersPaged } from "../../../actions";
|
import { getToken, azureHeadersPaged } from "../../../actions";
|
||||||
|
|
||||||
const WORDKEY = process.env.HASHKEY;
|
const WORDKEY = process.env.HASHKEY;
|
||||||
|
|
||||||
const WEBAPI_URL =
|
const WEBAPI_URL =
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import axios from "axios";
|
|||||||
import https from "https";
|
import https from "https";
|
||||||
import CryptoJS from "crypto-js";
|
import CryptoJS from "crypto-js";
|
||||||
import { getToken, azureHeadersPaged } from "../../../actions";
|
import { getToken, azureHeadersPaged } from "../../../actions";
|
||||||
|
|
||||||
const WORDKEY = process.env.HASHKEY;
|
const WORDKEY = process.env.HASHKEY;
|
||||||
|
|
||||||
const WEBAPI_URL =
|
const WEBAPI_URL =
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import axios from "axios";
|
|||||||
import https from "https";
|
import https from "https";
|
||||||
import CryptoJS from "crypto-js";
|
import CryptoJS from "crypto-js";
|
||||||
import { getToken, azureHeadersPaged } from "../../../actions";
|
import { getToken, azureHeadersPaged } from "../../../actions";
|
||||||
|
|
||||||
const WORDKEY = process.env.HASHKEY;
|
const WORDKEY = process.env.HASHKEY;
|
||||||
|
|
||||||
const WEBAPI_URL =
|
const WEBAPI_URL =
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ import {
|
|||||||
setSearchDetails,
|
setSearchDetails,
|
||||||
getSearchResultsObj,
|
getSearchResultsObj,
|
||||||
} from "../store/searchOutput/action";
|
} from "../store/searchOutput/action";
|
||||||
import { getBasicDNSSearch, getBasicSearchDetails, getToken } from "../actions";
|
import { getBasicDNSSearch, getBasicSearchDetails } from "../actions";
|
||||||
|
|
||||||
const Home = (props) => {
|
const Home = (props) => {
|
||||||
const { footerLinks, pages } = props;
|
const { footerLinks, pages } = props;
|
||||||
@@ -128,26 +128,7 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
|||||||
"public, s-maxage=10, stale-while-revalidate=59"
|
"public, s-maxage=10, stale-while-revalidate=59"
|
||||||
);
|
);
|
||||||
|
|
||||||
let token = await getToken();
|
let searchResultsObj = await getBasicDNSSearch();
|
||||||
|
|
||||||
var tokenIssuedAt = new Date();
|
|
||||||
var tokenExpiryTimeAt = new Date();
|
|
||||||
tokenExpiryTimeAt.setSeconds(
|
|
||||||
tokenExpiryTimeAt.getSeconds() + token.expires_in
|
|
||||||
);
|
|
||||||
|
|
||||||
// console.log(
|
|
||||||
// "token issued:",
|
|
||||||
// tokenIssuedAt.toUTCString(),
|
|
||||||
// "\n",
|
|
||||||
// "token expires:",
|
|
||||||
// tokenExpiryTimeAt.toUTCString()
|
|
||||||
// );
|
|
||||||
// console.log(token);
|
|
||||||
|
|
||||||
token = token.access_token;
|
|
||||||
|
|
||||||
let searchResultsObj = await getBasicDNSSearch(token);
|
|
||||||
searchResultsObj =
|
searchResultsObj =
|
||||||
searchResultsObj.status == 502
|
searchResultsObj.status == 502
|
||||||
? {
|
? {
|
||||||
@@ -157,11 +138,7 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
|||||||
}
|
}
|
||||||
: searchResultsObj;
|
: searchResultsObj;
|
||||||
|
|
||||||
const searchDetailsObj = await getSearchDetails(
|
const searchDetailsObj = await getSearchDetails(searchResultsObj);
|
||||||
token,
|
|
||||||
searchResultsObj
|
|
||||||
);
|
|
||||||
//console.log(searchDetailsObj);
|
|
||||||
store.dispatch(setSearchResults(searchResultsObj));
|
store.dispatch(setSearchResults(searchResultsObj));
|
||||||
store.dispatch(setSearchDetails(searchDetailsObj));
|
store.dispatch(setSearchDetails(searchDetailsObj));
|
||||||
store.dispatch(setSearch("DNS"));
|
store.dispatch(setSearch("DNS"));
|
||||||
|
|||||||
@@ -77,12 +77,9 @@ const Home = (props) => {
|
|||||||
export const getServerSideProps = wrapper.getServerSideProps(
|
export const getServerSideProps = wrapper.getServerSideProps(
|
||||||
(store) =>
|
(store) =>
|
||||||
async ({ query, req, res }) => {
|
async ({ query, req, res }) => {
|
||||||
let token = await getToken();
|
|
||||||
token = token.access_token;
|
|
||||||
|
|
||||||
const [appealTypeData, lpaData] = await Promise.all([
|
const [appealTypeData, lpaData] = await Promise.all([
|
||||||
await getAppealsTypes(token),
|
await getAppealsTypes(),
|
||||||
await getLPA(token),
|
await getLPA(),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
store.dispatch(setAppealType(appealTypeData));
|
store.dispatch(setAppealType(appealTypeData));
|
||||||
|
|||||||
@@ -62,10 +62,7 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
|||||||
console.log("query-", query);
|
console.log("query-", query);
|
||||||
//console.log("search array:", Object.entries(query));
|
//console.log("search array:", Object.entries(query));
|
||||||
|
|
||||||
let token = await getToken();
|
const searchResultsObj = await getAdvancedSearch(query);
|
||||||
token = token.access_token;
|
|
||||||
|
|
||||||
const searchResultsObj = await getAdvancedSearch(token, query);
|
|
||||||
const searchDetailsObj = await getSearchDetails(
|
const searchDetailsObj = await getSearchDetails(
|
||||||
token,
|
token,
|
||||||
searchResultsObj
|
searchResultsObj
|
||||||
|
|||||||
+9
-12
@@ -167,9 +167,6 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
|||||||
|
|
||||||
// console.log("the cookoies", cookies);
|
// console.log("the cookoies", cookies);
|
||||||
|
|
||||||
let token = await getToken();
|
|
||||||
token = token.access_token;
|
|
||||||
|
|
||||||
let loggedInUser = cookies.pinsUser;
|
let loggedInUser = cookies.pinsUser;
|
||||||
|
|
||||||
let providerConfig = await getProviderConfig();
|
let providerConfig = await getProviderConfig();
|
||||||
@@ -191,11 +188,11 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
|||||||
watchedCases,
|
watchedCases,
|
||||||
awaitingSubmission,
|
awaitingSubmission,
|
||||||
] = await Promise.all([
|
] = await Promise.all([
|
||||||
await getPersonalAccount(token, loggedInUser),
|
await getPersonalAccount(loggedInUser),
|
||||||
await getMyCases(token, loggedInUser),
|
await getMyCases(loggedInUser),
|
||||||
await getMyRepresentations(token, loggedInUser),
|
await getMyRepresentations(loggedInUser),
|
||||||
await getWatchedCases(token, loggedInUser),
|
await getWatchedCases(loggedInUser),
|
||||||
await getAwaitingSubmission(token),
|
await getAwaitingSubmission(),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
//const cookiesMaker = nookies.get(ctx)
|
//const cookiesMaker = nookies.get(ctx)
|
||||||
@@ -219,9 +216,9 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
|||||||
watchedCasesDetails,
|
watchedCasesDetails,
|
||||||
// awaitingSubmissionDetails,
|
// awaitingSubmissionDetails,
|
||||||
] = await Promise.all([
|
] = await Promise.all([
|
||||||
await getDetails(token, myCases, "myCases"),
|
await getDetails(myCases, "myCases"),
|
||||||
await getDetails(token, myRepresentations, "myRepresentations"),
|
await getDetails(myRepresentations, "myRepresentations"),
|
||||||
await getDetails(token, watchedCases, "myWatchedCases"),
|
await getDetails(watchedCases, "myWatchedCases"),
|
||||||
//await getDetails(awaitingSubmission),
|
//await getDetails(awaitingSubmission),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
@@ -243,7 +240,7 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
const getDetails = (token, resultsObj, detailsType) => {
|
const getDetails = (resultsObj, detailsType) => {
|
||||||
console.log(detailsType);
|
console.log(detailsType);
|
||||||
let detailsArr = [];
|
let detailsArr = [];
|
||||||
resultsObj = resultsObj.value;
|
resultsObj = resultsObj.value;
|
||||||
|
|||||||
@@ -82,14 +82,11 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
|||||||
|
|
||||||
const { cookies } = req;
|
const { cookies } = req;
|
||||||
|
|
||||||
let token = await getToken();
|
|
||||||
token = token.access_token;
|
|
||||||
|
|
||||||
let loggedInUser = cookies.pinsUser;
|
let loggedInUser = cookies.pinsUser;
|
||||||
|
|
||||||
let [searchResultsObj, watchedCases] = await Promise.all([
|
let [searchResultsObj, watchedCases] = await Promise.all([
|
||||||
await getBasicSearch(token, query.q),
|
await getBasicSearch(query.q),
|
||||||
await getWatchedCases(token, loggedInUser),
|
await getWatchedCases(loggedInUser),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
searchResultsObj =
|
searchResultsObj =
|
||||||
@@ -104,8 +101,8 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
|||||||
//console.log("sssss", searchResultsObj);
|
//console.log("sssss", searchResultsObj);
|
||||||
|
|
||||||
const [searchDetailsObj, watchedCasesDetails] = await Promise.all([
|
const [searchDetailsObj, watchedCasesDetails] = await Promise.all([
|
||||||
await getSearchDetails(token, searchResultsObj),
|
await getSearchDetails(searchResultsObj),
|
||||||
await getDetails(token, watchedCases, "myWatchedCases"),
|
await getDetails(watchedCases, "myWatchedCases"),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
store.dispatch(setSearchResults(searchResultsObj));
|
store.dispatch(setSearchResults(searchResultsObj));
|
||||||
@@ -116,7 +113,7 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
const getDetails = (token, resultsObj, detailsType) => {
|
const getDetails = (resultsObj, detailsType) => {
|
||||||
//console.log(resultsObj);
|
//console.log(resultsObj);
|
||||||
let detailsArr = [];
|
let detailsArr = [];
|
||||||
resultsObj = resultsObj.value;
|
resultsObj = resultsObj.value;
|
||||||
|
|||||||
@@ -331,8 +331,6 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
|||||||
console.log("the query", query);
|
console.log("the query", query);
|
||||||
let loggedInUser = cookies.pinsUser;
|
let loggedInUser = cookies.pinsUser;
|
||||||
|
|
||||||
let token = await getToken();
|
|
||||||
token = token.access_token;
|
|
||||||
const [
|
const [
|
||||||
caseReferenceData,
|
caseReferenceData,
|
||||||
appealTypeData,
|
appealTypeData,
|
||||||
@@ -340,11 +338,11 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
|||||||
pickListData,
|
pickListData,
|
||||||
formdata,
|
formdata,
|
||||||
] = await Promise.all([
|
] = await Promise.all([
|
||||||
await createCase(token, query.apt, query.lpa, loggedInUser),
|
await createCase(query.apt, query.lpa, loggedInUser),
|
||||||
await getAppealsTypes(token),
|
await getAppealsTypes(),
|
||||||
await getMandatoryFields(token, query.appealtypes),
|
await getMandatoryFields(query.appealtypes),
|
||||||
await getPickLists(token, query.appealtypes),
|
await getPickLists(query.appealtypes),
|
||||||
await getFormData(token, query.appealtypes),
|
await getFormData(query.appealtypes),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
let caseReference = caseReferenceData;
|
let caseReference = caseReferenceData;
|
||||||
|
|||||||
@@ -150,12 +150,9 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
|||||||
|
|
||||||
let loggedInUser = cookies.pinsUser;
|
let loggedInUser = cookies.pinsUser;
|
||||||
|
|
||||||
let token = await getToken();
|
|
||||||
token = token.access_token;
|
|
||||||
|
|
||||||
const [appealTypeData, lpaData, caseData] = await Promise.all([
|
const [appealTypeData, lpaData, caseData] = await Promise.all([
|
||||||
await getAppealsTypes(token),
|
await getAppealsTypes(),
|
||||||
await getLPA(token),
|
await getLPA(),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
store.dispatch(setAppealType(appealTypeData));
|
store.dispatch(setAppealType(appealTypeData));
|
||||||
|
|||||||
@@ -40,39 +40,4 @@ const Home = (props) => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
// export const getServerSideProps = wrapper.getServerSideProps(
|
|
||||||
// async ({ locale, store, req, res }) => {
|
|
||||||
// let token = await getToken()
|
|
||||||
// token = token.access_token;
|
|
||||||
// let accessToken = token.access_token;
|
|
||||||
|
|
||||||
// const apiRoot = process.browser ? window.API_ROOT : process.env.API_ROOT;
|
|
||||||
|
|
||||||
// const [pages, footerLinks, courseListContent] = await Promise.all([
|
|
||||||
// await getPages(accessToken, locale),
|
|
||||||
// await getFooterLinks(accessToken, locale),
|
|
||||||
// await getCourseList(accessToken, locale),
|
|
||||||
// ]);
|
|
||||||
// //const courseID = await getCourseID
|
|
||||||
// store.dispatch(setApiRoot(apiRoot));
|
|
||||||
// store.dispatch(setPages(pages));
|
|
||||||
// store.dispatch(setFooterLinks(footerLinks));
|
|
||||||
// store.dispatch(setCourseListContent(courseListContent));
|
|
||||||
// }
|
|
||||||
// );
|
|
||||||
|
|
||||||
// const mapStateToProps = (state) => {
|
|
||||||
// //console.log(state);
|
|
||||||
|
|
||||||
// return {
|
|
||||||
// apiroot: state.apiroot,
|
|
||||||
// courseListContent: state.courseListContent.courseListContent,
|
|
||||||
// pages: state.pages.pages,
|
|
||||||
// footerLinks: state.footerLinks.footerLinks,
|
|
||||||
// regions: state.regions,
|
|
||||||
// sectors: state.sectors,
|
|
||||||
// form: state.form,
|
|
||||||
// };
|
|
||||||
// };
|
|
||||||
|
|
||||||
export default Home; //connect(mapStateToProps)(Home);
|
export default Home; //connect(mapStateToProps)(Home);
|
||||||
|
|||||||
+2
-23
@@ -132,26 +132,8 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
|||||||
: false;
|
: false;
|
||||||
|
|
||||||
//console.log("is linked:", isLinked);
|
//console.log("is linked:", isLinked);
|
||||||
let token = await getToken();
|
|
||||||
|
|
||||||
var tokenIssuedAt = new Date();
|
let searchResultsObj = await getBasicSearch(query.q);
|
||||||
var tokenExpiryTimeAt = new Date();
|
|
||||||
tokenExpiryTimeAt.setSeconds(
|
|
||||||
tokenExpiryTimeAt.getSeconds() + token.expires_in
|
|
||||||
);
|
|
||||||
|
|
||||||
// console.log(
|
|
||||||
// "token issued:",
|
|
||||||
// tokenIssuedAt.toUTCString(),
|
|
||||||
// "\n",
|
|
||||||
// "token expires:",
|
|
||||||
// tokenExpiryTimeAt.toUTCString()
|
|
||||||
// );
|
|
||||||
// //console.log(token);
|
|
||||||
|
|
||||||
token = token.access_token;
|
|
||||||
|
|
||||||
let searchResultsObj = await getBasicSearch(token, query.q);
|
|
||||||
|
|
||||||
searchResultsObj =
|
searchResultsObj =
|
||||||
searchResultsObj.status == 502
|
searchResultsObj.status == 502
|
||||||
@@ -164,10 +146,7 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
|||||||
|
|
||||||
//console.log("sssss", searchResultsObj);
|
//console.log("sssss", searchResultsObj);
|
||||||
|
|
||||||
const searchDetailsObj = await getSearchDetails(
|
const searchDetailsObj = await getSearchDetails(searchResultsObj);
|
||||||
token,
|
|
||||||
searchResultsObj
|
|
||||||
);
|
|
||||||
|
|
||||||
store.dispatch(setSearchResults(searchResultsObj));
|
store.dispatch(setSearchResults(searchResultsObj));
|
||||||
store.dispatch(setSearchDetails(searchDetailsObj));
|
store.dispatch(setSearchDetails(searchDetailsObj));
|
||||||
|
|||||||
Reference in New Issue
Block a user