Merged PR 720: remove references to token
remove references to token Related work items: #7195
This commit is contained in:
+1
-1
@@ -43,7 +43,7 @@ RELAYPATH = "prod-pedw-hc"
|
||||
|
||||
|
||||
GOOGLE_TAG_MANAGER = GTM-T78CBC3
|
||||
SHOWLOGIN = "false"
|
||||
SHOWLOGIN = "true"
|
||||
SHOWREPRESENTATIONS = "false"
|
||||
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 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 +
|
||||
|
||||
@@ -16,7 +16,6 @@ import {
|
||||
getSearchDocumentHistory,
|
||||
getSearchDocumentHistoryPaged,
|
||||
getSearchDocumentDetailsPaged,
|
||||
getToken,
|
||||
} from "../../actions";
|
||||
|
||||
import {
|
||||
|
||||
@@ -6,7 +6,6 @@ import { setCurrentReference } from "../../store/currentView/action";
|
||||
import { connect } from "react-redux";
|
||||
import { parseCookies } from "nookies";
|
||||
import {
|
||||
getToken,
|
||||
getWatchedCasesProxy,
|
||||
getPortalModuleDetailsProxy,
|
||||
deleteWatchedCases,
|
||||
@@ -37,26 +36,21 @@ const TopThree = (props) => {
|
||||
let showTopThreeArr = showTopThree.value;
|
||||
|
||||
const deleteItem = (caseID, topThreeType) => {
|
||||
let token = getToken();
|
||||
let cookies = parseCookies();
|
||||
topThreeType == "watchedCases" &&
|
||||
deleteWatchedCases(caseID)
|
||||
.then((data) => data)
|
||||
.then(() => {
|
||||
getWatchedCasesProxy(token, cookies.pinsUser).then(
|
||||
(data) => {
|
||||
setWatchedCases(data),
|
||||
getDetails(token, data, "myWatchedCases").then(
|
||||
(data) => {
|
||||
setWatchedCasesDetails(data);
|
||||
}
|
||||
);
|
||||
}
|
||||
);
|
||||
getWatchedCasesProxy(cookies.pinsUser).then((data) => {
|
||||
setWatchedCases(data),
|
||||
getDetails(data, "myWatchedCases").then((data) => {
|
||||
setWatchedCasesDetails(data);
|
||||
});
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
const getDetails = (token, resultsObj, detailsType) => {
|
||||
const getDetails = (resultsObj, detailsType) => {
|
||||
//console.log(resultsObj);
|
||||
let detailsArr = [];
|
||||
resultsObj = resultsObj.value;
|
||||
@@ -72,7 +66,6 @@ const TopThree = (props) => {
|
||||
} else {
|
||||
detailsArr.push(
|
||||
getPortalModuleDetailsProxy(
|
||||
token,
|
||||
getFormCollectionByID(
|
||||
searchDetail.pinswg_appealcasetype
|
||||
).LogicalCollectionName,
|
||||
|
||||
@@ -39,7 +39,6 @@ import {
|
||||
|
||||
import {
|
||||
createWatchedCases,
|
||||
getToken,
|
||||
getWatchedCasesProxy,
|
||||
getPortalModuleDetailsProxy,
|
||||
deleteWatchedCases,
|
||||
@@ -78,8 +77,6 @@ const SearchResults = (props) => {
|
||||
const cookies = parseCookies();
|
||||
|
||||
const selectWatchedCase = (loggedInUser, incidentID, appealType) => {
|
||||
let token = getToken();
|
||||
|
||||
let updateBody = {
|
||||
"pinswg_WatchedCase@odata.bind": "/incidents(" + incidentID + ")",
|
||||
"pinswg_Contact@odata.bind": "/contacts(" + loggedInUser + ")",
|
||||
@@ -89,13 +86,11 @@ const SearchResults = (props) => {
|
||||
createWatchedCases(updateBody)
|
||||
.then((data) => data)
|
||||
.then(() => {
|
||||
getWatchedCasesProxy(token, cookies.pinsUser).then((data) => {
|
||||
getWatchedCasesProxy(cookies.pinsUser).then((data) => {
|
||||
setWatchedCases(data),
|
||||
getDetails(token, data, "myWatchedCases").then(
|
||||
(data) => {
|
||||
setWatchedCasesDetails(data);
|
||||
}
|
||||
);
|
||||
getDetails(data, "myWatchedCases").then((data) => {
|
||||
setWatchedCasesDetails(data);
|
||||
});
|
||||
});
|
||||
});
|
||||
};
|
||||
@@ -110,26 +105,21 @@ const SearchResults = (props) => {
|
||||
};
|
||||
|
||||
const deleteItem = (caseID, topThreeType) => {
|
||||
let token = getToken();
|
||||
let cookies = parseCookies();
|
||||
topThreeType == "watchedCases" &&
|
||||
deleteWatchedCases(caseID)
|
||||
.then((data) => data)
|
||||
.then(() => {
|
||||
getWatchedCasesProxy(token, cookies.pinsUser).then(
|
||||
(data) => {
|
||||
setWatchedCases(data),
|
||||
getDetails(token, data, "myWatchedCases").then(
|
||||
(data) => {
|
||||
setWatchedCasesDetails(data);
|
||||
}
|
||||
);
|
||||
}
|
||||
);
|
||||
getWatchedCasesProxy(cookies.pinsUser).then((data) => {
|
||||
setWatchedCases(data),
|
||||
getDetails(data, "myWatchedCases").then((data) => {
|
||||
setWatchedCasesDetails(data);
|
||||
});
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
const getDetails = (token, resultsObj, detailsType) => {
|
||||
const getDetails = (resultsObj, detailsType) => {
|
||||
//console.log(resultsObj);
|
||||
let detailsArr = [];
|
||||
resultsObj = resultsObj.value;
|
||||
@@ -145,7 +135,6 @@ const SearchResults = (props) => {
|
||||
} else {
|
||||
detailsArr.push(
|
||||
getPortalModuleDetailsProxy(
|
||||
token,
|
||||
getFormCollectionByID(
|
||||
searchDetail.pinswg_appealcasetype
|
||||
).LogicalCollectionName,
|
||||
|
||||
@@ -27,10 +27,9 @@ export const getFormCollectionByID = (appealTypeID) => {
|
||||
|
||||
/*
|
||||
* Get the details of a case from the appeal type
|
||||
* @param String token
|
||||
* @param object searchResultsObj
|
||||
*/
|
||||
export const getSearchDetails = (token, searchResultsObj) => {
|
||||
export const getSearchDetails = (searchResultsObj) => {
|
||||
//console.log(searchResultsObj);
|
||||
|
||||
let detailsArr = [];
|
||||
@@ -45,7 +44,6 @@ export const getSearchDetails = (token, searchResultsObj) => {
|
||||
//console.log(formMeta);
|
||||
detailsArr.push(
|
||||
getBasicSearchDetails(
|
||||
token,
|
||||
formMeta.LogicalCollectionName,
|
||||
searchDetail.title,
|
||||
formMeta.PrimaryIdAttribute,
|
||||
|
||||
+2
-20
@@ -139,27 +139,9 @@ const Home = (props) => {
|
||||
export const getServerSideProps = wrapper.getServerSideProps(
|
||||
(store) =>
|
||||
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([
|
||||
await getAppealsTypes(token),
|
||||
await getLPA(token),
|
||||
await getAppealsTypes(),
|
||||
await getLPA(),
|
||||
]);
|
||||
|
||||
store.dispatch(setAppealType(appealTypeData));
|
||||
|
||||
@@ -123,14 +123,8 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
||||
console.log("query-", query);
|
||||
//console.log("search array:", Object.entries(query));
|
||||
|
||||
let token = await getToken();
|
||||
token = token.access_token;
|
||||
|
||||
const searchResultsObj = await getAdvancedSearch(token, query);
|
||||
const searchDetailsObj = await getSearchDetails(
|
||||
token,
|
||||
searchResultsObj
|
||||
);
|
||||
const searchResultsObj = await getAdvancedSearch(query);
|
||||
const searchDetailsObj = await getSearchDetails(searchResultsObj);
|
||||
|
||||
store.dispatch(setSearchResults(searchResultsObj));
|
||||
store.dispatch(setSearchDetails(searchDetailsObj));
|
||||
|
||||
@@ -2,6 +2,7 @@ import axios from "axios";
|
||||
import https from "https";
|
||||
import CryptoJS from "crypto-js";
|
||||
import { getToken, azureHeadersPaged } from "../../../actions";
|
||||
|
||||
const WORDKEY = process.env.HASHKEY;
|
||||
|
||||
const WEBAPI_URL =
|
||||
@@ -41,7 +42,6 @@ export default async function ApiProxy(req, res) {
|
||||
|
||||
return axios(config)
|
||||
.then(({ data }) => {
|
||||
console.log("deleted ");
|
||||
res.status(200).json(data);
|
||||
})
|
||||
.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 CryptoJS from "crypto-js";
|
||||
import { getToken, azureHeadersPaged } from "../../../actions";
|
||||
|
||||
const WORDKEY = process.env.HASHKEY;
|
||||
|
||||
const WEBAPI_URL =
|
||||
|
||||
@@ -2,6 +2,7 @@ import axios from "axios";
|
||||
import https from "https";
|
||||
import CryptoJS from "crypto-js";
|
||||
import { getToken, azureHeadersPaged } from "../../../actions";
|
||||
|
||||
const WORDKEY = process.env.HASHKEY;
|
||||
|
||||
const WEBAPI_URL =
|
||||
|
||||
@@ -2,6 +2,7 @@ import axios from "axios";
|
||||
import https from "https";
|
||||
import CryptoJS from "crypto-js";
|
||||
import { getToken, azureHeadersPaged } from "../../../actions";
|
||||
|
||||
const WORDKEY = process.env.HASHKEY;
|
||||
|
||||
const WEBAPI_URL =
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
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 =
|
||||
@@ -24,12 +26,14 @@ export default async function ApiProxy(req, res) {
|
||||
var searchString = req.query.searchstring;
|
||||
var token = await getToken();
|
||||
|
||||
searchString = JSON.parse(searchString);
|
||||
searchString = _.isEmpty(searchString)
|
||||
? searchString
|
||||
: JSON.parse(decodeURI(searchString));
|
||||
|
||||
var queryString = "";
|
||||
|
||||
queryString +=
|
||||
searchString.q != null
|
||||
_.has(searchString, "q") && searchString.q != null
|
||||
? "(contains(title, '" +
|
||||
searchString.q +
|
||||
"') or contains(ticketnumber,'" +
|
||||
@@ -38,13 +42,13 @@ export default async function ApiProxy(req, res) {
|
||||
: "";
|
||||
|
||||
queryString +=
|
||||
searchString.lpa != null
|
||||
_.has(searchString, "lpa") && searchString.lpa != null
|
||||
? (typeof searchString.q == "undefined" ? "" : " and ") +
|
||||
"_pinswg_associatedlpa_value eq " +
|
||||
searchString.lpa
|
||||
: "";
|
||||
queryString +=
|
||||
searchString.apt != null
|
||||
_.has(searchString, "apt") && searchString.apt != null
|
||||
? (typeof searchString.q == "undefined" &&
|
||||
typeof searchString.lpa == "undefined"
|
||||
? ""
|
||||
@@ -58,15 +62,23 @@ export default async function ApiProxy(req, res) {
|
||||
queryString +
|
||||
" and pinswg_appealcasetype ne null and pinswg_publishtoweb eq true&$orderby=createdon desc&$count=true";
|
||||
|
||||
return axios
|
||||
.get(
|
||||
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
||||
azureHeadersPaged(token.access_token)
|
||||
)
|
||||
.then(({ data }) => {
|
||||
res.status(200).json(data);
|
||||
})
|
||||
.catch(({ err }) => {
|
||||
res.status(400).json(err);
|
||||
});
|
||||
var apiResponse = _.isEmpty(searchString)
|
||||
? res.status(400).json()
|
||||
: axios
|
||||
.get(
|
||||
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
||||
azureHeadersPaged(token.access_token)
|
||||
)
|
||||
.then(({ data }) => {
|
||||
var dataStr;
|
||||
_.has(data, "@odata.nextLink") == true &&
|
||||
((dataStr = JSON.stringify(data["@odata.nextLink"])),
|
||||
(data["@odata.nextLink"] = dataStr.split("/v8.2/")[1]));
|
||||
res.status(200).json(data);
|
||||
})
|
||||
.catch(({ err }) => {
|
||||
res.status(400).json(err);
|
||||
});
|
||||
|
||||
return apiResponse;
|
||||
}
|
||||
|
||||
@@ -27,12 +27,14 @@ export default async function ApiProxy(req, res) {
|
||||
var pageNumber = req.query.pageNumber;
|
||||
var token = await getToken();
|
||||
|
||||
searchString = JSON.parse(searchString);
|
||||
searchString = _.isEmpty(searchString)
|
||||
? searchString
|
||||
: JSON.parse(decodeURI(searchString));
|
||||
|
||||
var queryString = "";
|
||||
|
||||
queryString +=
|
||||
searchString.q != null
|
||||
_.has(searchString, "q") && searchString.q != null
|
||||
? "(contains(title, '" +
|
||||
searchString.q +
|
||||
"') or contains(ticketnumber,'" +
|
||||
@@ -41,13 +43,13 @@ export default async function ApiProxy(req, res) {
|
||||
: "";
|
||||
|
||||
queryString +=
|
||||
searchString.lpa != null
|
||||
_.has(searchString, "lpa") && searchString.lpa != null
|
||||
? (typeof searchString.q == "undefined" ? "" : " and ") +
|
||||
"_pinswg_associatedlpa_value eq " +
|
||||
searchString.lpa
|
||||
: "";
|
||||
queryString +=
|
||||
searchString.apt != null
|
||||
_.has(searchString, "apt") && searchString.apt != null
|
||||
? (typeof searchString.q == "undefined" &&
|
||||
typeof searchString.lpa == "undefined"
|
||||
? ""
|
||||
@@ -64,19 +66,23 @@ export default async function ApiProxy(req, res) {
|
||||
? "&$skiptoken=" + ('<cookie pagenumber="' + pageNumber + '" />')
|
||||
: "");
|
||||
|
||||
return axios
|
||||
.get(
|
||||
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
||||
azureHeadersPaged(token.access_token)
|
||||
)
|
||||
.then(({ data }) => {
|
||||
var dataStr;
|
||||
_.has(data, "@odata.nextLink") == true &&
|
||||
((dataStr = JSON.stringify(data["@odata.nextLink"])),
|
||||
(data["@odata.nextLink"] = dataStr.split("/v8.2/")[1]));
|
||||
res.status(200).json(data);
|
||||
})
|
||||
.catch(({ err }) => {
|
||||
res.status(400).json(err);
|
||||
});
|
||||
var apiResponse = _.isEmpty(searchString)
|
||||
? res.status(400).json()
|
||||
: axios
|
||||
.get(
|
||||
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
||||
azureHeadersPaged(token.access_token)
|
||||
)
|
||||
.then(({ data }) => {
|
||||
var dataStr;
|
||||
_.has(data, "@odata.nextLink") == true &&
|
||||
((dataStr = JSON.stringify(data["@odata.nextLink"])),
|
||||
(data["@odata.nextLink"] = dataStr.split("/v8.2/")[1]));
|
||||
res.status(200).json(data);
|
||||
})
|
||||
.catch(({ err }) => {
|
||||
res.status(400).json(err);
|
||||
});
|
||||
|
||||
return apiResponse;
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ import axios from "axios";
|
||||
import https from "https";
|
||||
import CryptoJS from "crypto-js";
|
||||
import { getToken, azureHeaders } from "../../../actions";
|
||||
|
||||
const WORDKEY = process.env.HASHKEY;
|
||||
|
||||
const WEBAPI_URL =
|
||||
|
||||
@@ -2,6 +2,17 @@ import axios from "axios";
|
||||
import https from "https";
|
||||
import CryptoJS from "crypto-js";
|
||||
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 WEBAPI_URL =
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import axios from "axios";
|
||||
import https from "https";
|
||||
import CryptoJS from "crypto-js";
|
||||
import _ from "lodash";
|
||||
import { getToken, azureHeaders, azureHeadersPaged } from "../../../actions";
|
||||
|
||||
const WORDKEY = process.env.HASHKEY;
|
||||
@@ -33,6 +34,10 @@ export default async function ApiProxy(req, res) {
|
||||
azureHeadersPaged(token.access_token)
|
||||
)
|
||||
.then(({ data }) => {
|
||||
var dataStr;
|
||||
_.has(data, "@odata.nextLink") == true &&
|
||||
((dataStr = JSON.stringify(data["@odata.nextLink"])),
|
||||
(data["@odata.nextLink"] = dataStr.split("/v8.2/")[1]));
|
||||
res.status(200).json(data);
|
||||
})
|
||||
.catch(({ err }) => {
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
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 =
|
||||
@@ -29,15 +31,21 @@ export default async function ApiProxy(req, res) {
|
||||
caseReference +
|
||||
"'&$count=true";
|
||||
|
||||
return axios
|
||||
.get(
|
||||
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
||||
azureHeaders(token.access_token)
|
||||
)
|
||||
.then(({ data }) => {
|
||||
res.status(200).json(data);
|
||||
})
|
||||
.catch(({ err }) => {
|
||||
res.status(400).json(err);
|
||||
});
|
||||
var apiResponse = _.isEmpty(req.query)
|
||||
? res.status(400).json()
|
||||
: typeof caseReference != "undefined" && caseReference.length > 0
|
||||
? axios
|
||||
.get(
|
||||
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
||||
azureHeaders(token.access_token)
|
||||
)
|
||||
.then(({ data }) => {
|
||||
res.status(200).json(data);
|
||||
})
|
||||
.catch(({ err }) => {
|
||||
res.status(400).json(err);
|
||||
})
|
||||
: res.status(400).json();
|
||||
|
||||
return apiResponse;
|
||||
}
|
||||
|
||||
@@ -31,19 +31,25 @@ export default async function ApiProxy(req, res) {
|
||||
caseReference +
|
||||
"'&$count=true";
|
||||
|
||||
return axios
|
||||
.get(
|
||||
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
||||
azureHeadersPaged(token.access_token)
|
||||
)
|
||||
.then(({ data }) => {
|
||||
var dataStr;
|
||||
_.has(data, "@odata.nextLink") == true &&
|
||||
((dataStr = JSON.stringify(data["@odata.nextLink"])),
|
||||
(data["@odata.nextLink"] = dataStr.split("/v8.2/")[1]));
|
||||
return res.status(200).json(data);
|
||||
})
|
||||
.catch(({ err }) => {
|
||||
res.status(400).json(err);
|
||||
});
|
||||
var apiResponse = _.isEmpty(req.query)
|
||||
? res.status(400).json()
|
||||
: typeof caseReference != "undefined" && caseReference.length > 0
|
||||
? axios
|
||||
.get(
|
||||
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
||||
azureHeadersPaged(token.access_token)
|
||||
)
|
||||
.then(({ data }) => {
|
||||
var dataStr;
|
||||
_.has(data, "@odata.nextLink") == true &&
|
||||
((dataStr = JSON.stringify(data["@odata.nextLink"])),
|
||||
(data["@odata.nextLink"] = dataStr.split("/v8.2/")[1]));
|
||||
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 https from "https";
|
||||
import CryptoJS from "crypto-js";
|
||||
import _ from "lodash";
|
||||
import { getToken, azureHeadersPaged } from "../../../actions";
|
||||
|
||||
const WORDKEY = process.env.HASHKEY;
|
||||
|
||||
const WEBAPI_URL =
|
||||
@@ -31,15 +33,25 @@ export default async function ApiProxy(req, res) {
|
||||
searchString +
|
||||
"')) and pinswg_appealcasetype ne null and pinswg_publishtoweb eq true&$orderby=createdon desc&$count=true";
|
||||
|
||||
return axios
|
||||
.get(
|
||||
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
||||
azureHeadersPaged(token.access_token)
|
||||
)
|
||||
.then(({ data }) => {
|
||||
res.status(200).json(data);
|
||||
})
|
||||
.catch(({ err }) => {
|
||||
res.status(400).json(err);
|
||||
});
|
||||
var apiResponse = _.isEmpty(req.query)
|
||||
? res.status(400).json()
|
||||
: searchString.length > 0
|
||||
? axios
|
||||
.get(
|
||||
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
||||
azureHeadersPaged(token.access_token)
|
||||
)
|
||||
.then(({ data }) => {
|
||||
var dataStr;
|
||||
_.has(data, "@odata.nextLink") == true &&
|
||||
((dataStr = JSON.stringify(data["@odata.nextLink"])),
|
||||
(data["@odata.nextLink"] = dataStr.split("/v8.2/")[1]));
|
||||
res.status(200).json(data);
|
||||
})
|
||||
.catch(({ err }) => {
|
||||
res.status(400).json(err);
|
||||
})
|
||||
: res.status(400).json();
|
||||
|
||||
return apiResponse;
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ import axios from "axios";
|
||||
import https from "https";
|
||||
import CryptoJS from "crypto-js";
|
||||
import { getToken, azureHeaders } from "../../../actions";
|
||||
|
||||
const WORDKEY = process.env.HASHKEY;
|
||||
|
||||
const WEBAPI_URL =
|
||||
|
||||
@@ -35,19 +35,25 @@ export default async function ApiProxy(req, res) {
|
||||
? "&$skiptoken=" + '<cookie pagenumber="' + pageNumber + '" />'
|
||||
: "");
|
||||
|
||||
return axios
|
||||
.get(
|
||||
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
||||
azureHeadersPaged(token.access_token)
|
||||
)
|
||||
.then(({ data }) => {
|
||||
var dataStr;
|
||||
_.has(data, "@odata.nextLink") == true &&
|
||||
((dataStr = JSON.stringify(data["@odata.nextLink"])),
|
||||
(data["@odata.nextLink"] = dataStr.split("/v8.2/")[1]));
|
||||
return res.status(200).json(data);
|
||||
})
|
||||
.catch(({ err }) => {
|
||||
res.status(400).json(err);
|
||||
});
|
||||
var apiResponse =
|
||||
searchString.length > 0
|
||||
? axios
|
||||
.get(
|
||||
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
||||
azureHeadersPaged(token.access_token)
|
||||
)
|
||||
.then(({ data }) => {
|
||||
var dataStr;
|
||||
_.has(data, "@odata.nextLink") == true &&
|
||||
((dataStr = JSON.stringify(data["@odata.nextLink"])),
|
||||
(data["@odata.nextLink"] =
|
||||
dataStr.split("/v8.2/")[1]));
|
||||
res.status(200).json(data);
|
||||
})
|
||||
.catch(({ err }) => {
|
||||
res.status(400).json(err);
|
||||
})
|
||||
: res.status(400).json();
|
||||
|
||||
return apiResponse;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
import axios from "axios";
|
||||
import https from "https";
|
||||
import CryptoJS from "crypto-js";
|
||||
import _ from "lodash";
|
||||
import { getToken, azureHeaders } from "../../../actions";
|
||||
|
||||
const WORDKEY = process.env.HASHKEY;
|
||||
|
||||
const WEBAPI_URL =
|
||||
@@ -26,15 +28,21 @@ export default async function ApiProxy(req, res) {
|
||||
emailAddress +
|
||||
"'&$count=true&$select=emailaddress1, contactid";
|
||||
|
||||
return axios
|
||||
.get(
|
||||
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
||||
azureHeaders(token.access_token)
|
||||
)
|
||||
.then(({ data }) => {
|
||||
res.status(200).json(data);
|
||||
})
|
||||
.catch(({ err }) => {
|
||||
res.status(400).json(err);
|
||||
});
|
||||
var apiResponse = _.isEmpty(req.query)
|
||||
? res.status(400).json()
|
||||
: typeof emailAddress != "undefined" && emailAddress.length > 0
|
||||
? axios
|
||||
.get(
|
||||
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
||||
azureHeaders(token.access_token)
|
||||
)
|
||||
.then(({ data }) => {
|
||||
res.status(200).json(data);
|
||||
})
|
||||
.catch(({ err }) => {
|
||||
res.status(400).json(err);
|
||||
})
|
||||
: res.status(400).json();
|
||||
|
||||
return apiResponse;
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ import axios from "axios";
|
||||
import https from "https";
|
||||
import CryptoJS from "crypto-js";
|
||||
import { getToken, azureHeadersPaged, azureHeaders } from "../../../actions";
|
||||
|
||||
const WORDKEY = process.env.HASHKEY;
|
||||
|
||||
const WEBAPI_URL =
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
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 =
|
||||
@@ -29,15 +31,26 @@ export default async function ApiProxy(req, res) {
|
||||
pwd +
|
||||
"'&$count=true&$select=emailaddress1,contactid,pinswg_custom_password,yomifullname,firstname,lastname";
|
||||
|
||||
return axios
|
||||
.get(
|
||||
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
||||
azureHeadersPaged(token.access_token)
|
||||
)
|
||||
.then(({ data }) => {
|
||||
res.status(200).json(data);
|
||||
})
|
||||
.catch(({ err }) => {
|
||||
res.status(400).json(err);
|
||||
});
|
||||
console.log(_.isEmpty(req.query));
|
||||
|
||||
var apiResponse = _.isEmpty(req.query)
|
||||
? res.status(400).json()
|
||||
: typeof emailAddress != "undefined" &&
|
||||
emailAddress.length > 0 &&
|
||||
typeof pwd != "undefined" &&
|
||||
pwd.length > 0
|
||||
? axios
|
||||
.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 CryptoJS from "crypto-js";
|
||||
import { getToken, azureHeadersPaged, azureHeaders } from "../../../actions";
|
||||
|
||||
const WORDKEY = process.env.HASHKEY;
|
||||
|
||||
const WEBAPI_URL =
|
||||
|
||||
@@ -2,6 +2,7 @@ import axios from "axios";
|
||||
import https from "https";
|
||||
import CryptoJS from "crypto-js";
|
||||
import { getToken, azureHeadersPaged, azureHeaders } from "../../../actions";
|
||||
|
||||
const WORDKEY = process.env.HASHKEY;
|
||||
|
||||
const WEBAPI_URL =
|
||||
|
||||
@@ -2,6 +2,7 @@ import axios from "axios";
|
||||
import https from "https";
|
||||
import CryptoJS from "crypto-js";
|
||||
import { getToken, azureHeaders } from "../../../actions";
|
||||
|
||||
const WORDKEY = process.env.HASHKEY;
|
||||
|
||||
const WEBAPI_URL =
|
||||
|
||||
@@ -2,6 +2,7 @@ import axios from "axios";
|
||||
import https from "https";
|
||||
import CryptoJS from "crypto-js";
|
||||
import { getToken, azureHeaders } from "../../../actions";
|
||||
|
||||
const WORDKEY = process.env.HASHKEY;
|
||||
|
||||
const WEBAPI_URL =
|
||||
|
||||
@@ -2,6 +2,7 @@ import axios from "axios";
|
||||
import https from "https";
|
||||
import CryptoJS from "crypto-js";
|
||||
import { getToken, azureHeaders } from "../../../actions";
|
||||
|
||||
const WORDKEY = process.env.HASHKEY;
|
||||
|
||||
const WEBAPI_URL =
|
||||
|
||||
@@ -2,6 +2,7 @@ import axios from "axios";
|
||||
import https from "https";
|
||||
import CryptoJS from "crypto-js";
|
||||
import { getToken, azureHeaders } from "../../../actions";
|
||||
|
||||
const WORDKEY = process.env.HASHKEY;
|
||||
|
||||
const WEBAPI_URL =
|
||||
@@ -20,21 +21,27 @@ const hashAPIPath = (queryPath) => {
|
||||
export default async function ApiProxy(req, res) {
|
||||
var contactid = req.query.contactid;
|
||||
var token = await getToken();
|
||||
console.log(" eeee", contactid.length);
|
||||
|
||||
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.access_token)
|
||||
)
|
||||
.then(({ data }) => {
|
||||
res.status(200).json(data);
|
||||
})
|
||||
.catch(({ err }) => {
|
||||
res.status(400).json(err);
|
||||
});
|
||||
var apiResponse =
|
||||
contactid.length > 0
|
||||
? axios
|
||||
.get(
|
||||
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
||||
azureHeaders(token.access_token)
|
||||
)
|
||||
.then(({ data }) => {
|
||||
res.status(200).json(data);
|
||||
})
|
||||
.catch(({ err }) => {
|
||||
res.status(400).json(err);
|
||||
})
|
||||
: res.status(400).json();
|
||||
|
||||
return apiResponse;
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ import axios from "axios";
|
||||
import https from "https";
|
||||
import CryptoJS from "crypto-js";
|
||||
import { getToken, azureHeaders } from "../../../actions";
|
||||
|
||||
const WORDKEY = process.env.HASHKEY;
|
||||
|
||||
const WEBAPI_URL =
|
||||
|
||||
@@ -2,6 +2,7 @@ import axios from "axios";
|
||||
import https from "https";
|
||||
import CryptoJS from "crypto-js";
|
||||
import { getToken, azureHeaders } from "../../../actions";
|
||||
|
||||
const WORDKEY = process.env.HASHKEY;
|
||||
|
||||
const WEBAPI_URL =
|
||||
|
||||
@@ -2,6 +2,7 @@ import axios from "axios";
|
||||
import https from "https";
|
||||
import CryptoJS from "crypto-js";
|
||||
import { getToken, azureHeaders } from "../../../actions";
|
||||
|
||||
const WORDKEY = process.env.HASHKEY;
|
||||
|
||||
const WEBAPI_URL =
|
||||
|
||||
@@ -2,6 +2,7 @@ import axios from "axios";
|
||||
import https from "https";
|
||||
import CryptoJS from "crypto-js";
|
||||
import { getToken, azureHeaders } from "../../../actions";
|
||||
|
||||
const WORDKEY = process.env.HASHKEY;
|
||||
|
||||
const WEBAPI_URL =
|
||||
|
||||
@@ -2,6 +2,7 @@ import axios from "axios";
|
||||
import https from "https";
|
||||
import CryptoJS from "crypto-js";
|
||||
import { getToken, azureHeaders } from "../../../actions";
|
||||
|
||||
const WORDKEY = process.env.HASHKEY;
|
||||
|
||||
const WEBAPI_URL =
|
||||
|
||||
@@ -2,6 +2,7 @@ import axios from "axios";
|
||||
import https from "https";
|
||||
import CryptoJS from "crypto-js";
|
||||
import { getToken, azureHeaders } from "../../../actions";
|
||||
|
||||
const WORDKEY = process.env.HASHKEY;
|
||||
|
||||
const WEBAPI_URL =
|
||||
|
||||
@@ -2,6 +2,7 @@ import axios from "axios";
|
||||
import https from "https";
|
||||
import CryptoJS from "crypto-js";
|
||||
import { getToken, azureHeaders } from "../../../actions";
|
||||
|
||||
const WORDKEY = process.env.HASHKEY;
|
||||
|
||||
const WEBAPI_URL =
|
||||
|
||||
@@ -2,6 +2,7 @@ import axios from "axios";
|
||||
import https from "https";
|
||||
import CryptoJS from "crypto-js";
|
||||
import { getToken, azureHeaders } from "../../../actions";
|
||||
|
||||
const WORDKEY = process.env.HASHKEY;
|
||||
|
||||
const WEBAPI_URL =
|
||||
|
||||
@@ -2,6 +2,7 @@ import axios from "axios";
|
||||
import https from "https";
|
||||
import CryptoJS from "crypto-js";
|
||||
import { getToken, azureHeadersPaged } from "../../../actions";
|
||||
|
||||
const WORDKEY = process.env.HASHKEY;
|
||||
|
||||
const WEBAPI_URL =
|
||||
|
||||
@@ -2,6 +2,7 @@ import axios from "axios";
|
||||
import https from "https";
|
||||
import CryptoJS from "crypto-js";
|
||||
import { getToken, azureHeadersPaged } from "../../../actions";
|
||||
|
||||
const WORDKEY = process.env.HASHKEY;
|
||||
|
||||
const WEBAPI_URL =
|
||||
|
||||
@@ -2,6 +2,7 @@ import axios from "axios";
|
||||
import https from "https";
|
||||
import CryptoJS from "crypto-js";
|
||||
import { getToken, azureHeadersPaged } from "../../../actions";
|
||||
|
||||
const WORDKEY = process.env.HASHKEY;
|
||||
|
||||
const WEBAPI_URL =
|
||||
|
||||
@@ -24,7 +24,7 @@ import {
|
||||
setSearchDetails,
|
||||
getSearchResultsObj,
|
||||
} from "../store/searchOutput/action";
|
||||
import { getBasicDNSSearch, getBasicSearchDetails, getToken } from "../actions";
|
||||
import { getBasicDNSSearch, getBasicSearchDetails } from "../actions";
|
||||
|
||||
const Home = (props) => {
|
||||
const { footerLinks, pages } = props;
|
||||
@@ -128,26 +128,7 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
||||
"public, s-maxage=10, stale-while-revalidate=59"
|
||||
);
|
||||
|
||||
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;
|
||||
|
||||
let searchResultsObj = await getBasicDNSSearch(token);
|
||||
let searchResultsObj = await getBasicDNSSearch();
|
||||
searchResultsObj =
|
||||
searchResultsObj.status == 502
|
||||
? {
|
||||
@@ -157,11 +138,7 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
||||
}
|
||||
: searchResultsObj;
|
||||
|
||||
const searchDetailsObj = await getSearchDetails(
|
||||
token,
|
||||
searchResultsObj
|
||||
);
|
||||
//console.log(searchDetailsObj);
|
||||
const searchDetailsObj = await getSearchDetails(searchResultsObj);
|
||||
store.dispatch(setSearchResults(searchResultsObj));
|
||||
store.dispatch(setSearchDetails(searchDetailsObj));
|
||||
store.dispatch(setSearch("DNS"));
|
||||
|
||||
@@ -77,12 +77,9 @@ const Home = (props) => {
|
||||
export const getServerSideProps = wrapper.getServerSideProps(
|
||||
(store) =>
|
||||
async ({ query, req, res }) => {
|
||||
let token = await getToken();
|
||||
token = token.access_token;
|
||||
|
||||
const [appealTypeData, lpaData] = await Promise.all([
|
||||
await getAppealsTypes(token),
|
||||
await getLPA(token),
|
||||
await getAppealsTypes(),
|
||||
await getLPA(),
|
||||
]);
|
||||
|
||||
store.dispatch(setAppealType(appealTypeData));
|
||||
|
||||
@@ -62,10 +62,7 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
||||
console.log("query-", query);
|
||||
//console.log("search array:", Object.entries(query));
|
||||
|
||||
let token = await getToken();
|
||||
token = token.access_token;
|
||||
|
||||
const searchResultsObj = await getAdvancedSearch(token, query);
|
||||
const searchResultsObj = await getAdvancedSearch(query);
|
||||
const searchDetailsObj = await getSearchDetails(
|
||||
token,
|
||||
searchResultsObj
|
||||
|
||||
+9
-12
@@ -167,9 +167,6 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
||||
|
||||
// console.log("the cookoies", cookies);
|
||||
|
||||
let token = await getToken();
|
||||
token = token.access_token;
|
||||
|
||||
let loggedInUser = cookies.pinsUser;
|
||||
|
||||
let providerConfig = await getProviderConfig();
|
||||
@@ -191,11 +188,11 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
||||
watchedCases,
|
||||
awaitingSubmission,
|
||||
] = await Promise.all([
|
||||
await getPersonalAccount(token, loggedInUser),
|
||||
await getMyCases(token, loggedInUser),
|
||||
await getMyRepresentations(token, loggedInUser),
|
||||
await getWatchedCases(token, loggedInUser),
|
||||
await getAwaitingSubmission(token),
|
||||
await getPersonalAccount(loggedInUser),
|
||||
await getMyCases(loggedInUser),
|
||||
await getMyRepresentations(loggedInUser),
|
||||
await getWatchedCases(loggedInUser),
|
||||
await getAwaitingSubmission(),
|
||||
]);
|
||||
|
||||
//const cookiesMaker = nookies.get(ctx)
|
||||
@@ -219,9 +216,9 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
||||
watchedCasesDetails,
|
||||
// awaitingSubmissionDetails,
|
||||
] = await Promise.all([
|
||||
await getDetails(token, myCases, "myCases"),
|
||||
await getDetails(token, myRepresentations, "myRepresentations"),
|
||||
await getDetails(token, watchedCases, "myWatchedCases"),
|
||||
await getDetails(myCases, "myCases"),
|
||||
await getDetails(myRepresentations, "myRepresentations"),
|
||||
await getDetails(watchedCases, "myWatchedCases"),
|
||||
//await getDetails(awaitingSubmission),
|
||||
]);
|
||||
|
||||
@@ -243,7 +240,7 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
||||
}
|
||||
);
|
||||
|
||||
const getDetails = (token, resultsObj, detailsType) => {
|
||||
const getDetails = (resultsObj, detailsType) => {
|
||||
console.log(detailsType);
|
||||
let detailsArr = [];
|
||||
resultsObj = resultsObj.value;
|
||||
|
||||
@@ -82,14 +82,11 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
||||
|
||||
const { cookies } = req;
|
||||
|
||||
let token = await getToken();
|
||||
token = token.access_token;
|
||||
|
||||
let loggedInUser = cookies.pinsUser;
|
||||
|
||||
let [searchResultsObj, watchedCases] = await Promise.all([
|
||||
await getBasicSearch(token, query.q),
|
||||
await getWatchedCases(token, loggedInUser),
|
||||
await getBasicSearch(query.q),
|
||||
await getWatchedCases(loggedInUser),
|
||||
]);
|
||||
|
||||
searchResultsObj =
|
||||
@@ -104,8 +101,8 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
||||
//console.log("sssss", searchResultsObj);
|
||||
|
||||
const [searchDetailsObj, watchedCasesDetails] = await Promise.all([
|
||||
await getSearchDetails(token, searchResultsObj),
|
||||
await getDetails(token, watchedCases, "myWatchedCases"),
|
||||
await getSearchDetails(searchResultsObj),
|
||||
await getDetails(watchedCases, "myWatchedCases"),
|
||||
]);
|
||||
|
||||
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);
|
||||
let detailsArr = [];
|
||||
resultsObj = resultsObj.value;
|
||||
|
||||
@@ -331,8 +331,6 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
||||
console.log("the query", query);
|
||||
let loggedInUser = cookies.pinsUser;
|
||||
|
||||
let token = await getToken();
|
||||
token = token.access_token;
|
||||
const [
|
||||
caseReferenceData,
|
||||
appealTypeData,
|
||||
@@ -340,11 +338,11 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
||||
pickListData,
|
||||
formdata,
|
||||
] = await Promise.all([
|
||||
await createCase(token, query.apt, query.lpa, loggedInUser),
|
||||
await getAppealsTypes(token),
|
||||
await getMandatoryFields(token, query.appealtypes),
|
||||
await getPickLists(token, query.appealtypes),
|
||||
await getFormData(token, query.appealtypes),
|
||||
await createCase(query.apt, query.lpa, loggedInUser),
|
||||
await getAppealsTypes(),
|
||||
await getMandatoryFields(query.appealtypes),
|
||||
await getPickLists(query.appealtypes),
|
||||
await getFormData(query.appealtypes),
|
||||
]);
|
||||
|
||||
let caseReference = caseReferenceData;
|
||||
|
||||
@@ -150,12 +150,9 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
||||
|
||||
let loggedInUser = cookies.pinsUser;
|
||||
|
||||
let token = await getToken();
|
||||
token = token.access_token;
|
||||
|
||||
const [appealTypeData, lpaData, caseData] = await Promise.all([
|
||||
await getAppealsTypes(token),
|
||||
await getLPA(token),
|
||||
await getAppealsTypes(),
|
||||
await getLPA(),
|
||||
]);
|
||||
|
||||
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);
|
||||
|
||||
+2
-23
@@ -132,26 +132,8 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
||||
: false;
|
||||
|
||||
//console.log("is linked:", isLinked);
|
||||
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;
|
||||
|
||||
let searchResultsObj = await getBasicSearch(token, query.q);
|
||||
let searchResultsObj = await getBasicSearch(query.q);
|
||||
|
||||
searchResultsObj =
|
||||
searchResultsObj.status == 502
|
||||
@@ -164,10 +146,7 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
||||
|
||||
//console.log("sssss", searchResultsObj);
|
||||
|
||||
const searchDetailsObj = await getSearchDetails(
|
||||
token,
|
||||
searchResultsObj
|
||||
);
|
||||
const searchDetailsObj = await getSearchDetails(searchResultsObj);
|
||||
|
||||
store.dispatch(setSearchResults(searchResultsObj));
|
||||
store.dispatch(setSearchDetails(searchDetailsObj));
|
||||
|
||||
Reference in New Issue
Block a user