Merged PR 716: removed proxy and added endpoints for methods
removed proxy and added endpoints for methods Related work items: #7184
This commit is contained in:
+21
-18
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
ACCESS_TOKEN_ENDPOINT = https://login.microsoftonline.com/
|
ACCESS_TOKEN_ENDPOINT = https://login.microsoftonline.com/
|
||||||
TENANT = a8d860de-d5e1-45af-8376-d93f02e6b502
|
TENANT = a8d860de-d5e1-45af-8376-d93f02e6b502
|
||||||
|
//TENANT = 9ac1a5ab-cd58-409e-a1b6-6b10422a68f5
|
||||||
GRANT_TYPE = "client_credentials"
|
GRANT_TYPE = "client_credentials"
|
||||||
|
|
||||||
HASHKEY = 028ffbae928d7191c0017f298260995f901d78eabde1436c0af0423459cc3715832136d84f68818d3a96399467b52143e273d4f3bf4ae190848891535421cd6c
|
HASHKEY = 028ffbae928d7191c0017f298260995f901d78eabde1436c0af0423459cc3715832136d84f68818d3a96399467b52143e273d4f3bf4ae190848891535421cd6c
|
||||||
@@ -9,24 +10,24 @@ NEXT_PUBLIC_HASHKEY = 028ffbae928d7191c0017f298260995f901d78eabde1436c0af0423459
|
|||||||
|
|
||||||
|
|
||||||
//Dev oauth
|
//Dev oauth
|
||||||
//CLIENT_ID = e082def0-3453-461f-9a5e-f4ab127dc015
|
CLIENT_ID = e082def0-3453-461f-9a5e-f4ab127dc015
|
||||||
//CLIENT_SECRET = qW.7Q~TSr3sZmLEnJQJPXEdOckb_yo2t1yJmY
|
CLIENT_SECRET = qW.7Q~TSr3sZmLEnJQJPXEdOckb_yo2t1yJmY
|
||||||
//RELAY_ROOT = https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/
|
RELAY_ROOT = https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/
|
||||||
//RELAYURI = "dev-pedw-ns.servicebus.windows.net"
|
RELAYURI = "dev-pedw-ns.servicebus.windows.net"
|
||||||
//RELAYPATH = "dev-pedw-hc"
|
RELAYPATH = "dev-pedw-hc"
|
||||||
|
|
||||||
|
|
||||||
//Test Oauth
|
//Test Oauth
|
||||||
CLIENT_ID = 6619ad85-c908-490d-811b-de8c93c0f2aa
|
//CLIENT_ID = 6619ad85-c908-490d-811b-de8c93c0f2aa
|
||||||
CLIENT_SECRET = qKo7Q~5QvLEplbwnBbint_I5lXqx_-kDm8Vj-
|
//CLIENT_SECRET = qKo7Q~5QvLEplbwnBbint_I5lXqx_-kDm8Vj-
|
||||||
RELAY_ROOT = https://test-pedw-ns.servicebus.windows.net/test-pedw-hc/
|
//RELAY_ROOT = https://test-pedw-ns.servicebus.windows.net/test-pedw-hc/
|
||||||
RELAYURI = "test-pedw-ns.servicebus.windows.net"
|
//RELAYURI = "test-pedw-ns.servicebus.windows.net"
|
||||||
RELAYPATH = "test-pedw-hc"
|
//RELAYPATH = "test-pedw-hc"
|
||||||
|
|
||||||
|
|
||||||
//Preprod Oauth
|
//Preprod Oauth
|
||||||
//CLIENT_ID = 75594242-8773-45c7-a3da-85e62485b2f3
|
//CLIENT_ID = ab6c4678-b31a-4eb3-b429-e039120e488a
|
||||||
//CLIENT_SECRET = UDF7Q~OwTLIV7LXPHlIYHSWbJunlBD53ieLt-
|
//CLIENT_SECRET = Ioo7Q~RJfhWsE45wPsuHm1CzRk1SppnNN3lZF
|
||||||
//RELAY_ROOT = https://pp-pedw-ns.servicebus.windows.net/pp-pedw-hc/
|
//RELAY_ROOT = https://pp-pedw-ns.servicebus.windows.net/pp-pedw-hc/
|
||||||
//RELAYURI = "pp-pedw-ns.servicebus.windows.net"
|
//RELAYURI = "pp-pedw-ns.servicebus.windows.net"
|
||||||
//RELAYPATH = "pp-pedw-hc"
|
//RELAYPATH = "pp-pedw-hc"
|
||||||
@@ -34,15 +35,15 @@ RELAYPATH = "test-pedw-hc"
|
|||||||
|
|
||||||
|
|
||||||
//Prod Oauth
|
//Prod Oauth
|
||||||
//CLIENT_ID = 01904c07-9035-4cf9-a535-3945f6e470d2
|
CLIENT_ID = 01904c07-9035-4cf9-a535-3945f6e470d2
|
||||||
//CLIENT_SECRET = PRo7Q~GQoKSdARRqF-NOXQDx2Ka8UCINyvagk
|
CLIENT_SECRET = PRo7Q~GQoKSdARRqF-NOXQDx2Ka8UCINyvagk
|
||||||
//RELAY_ROOT = https://prod-pedw-ns.servicebus.windows.net/prod-pedw-hc/
|
RELAY_ROOT = https://prod-pedw-ns.servicebus.windows.net/prod-pedw-hc/
|
||||||
//RELAYURI = "prod-pedw-ns.servicebus.windows.net"
|
RELAYURI = "prod-pedw-ns.servicebus.windows.net"
|
||||||
//RELAYPATH = "prod-pedw-hc"
|
RELAYPATH = "prod-pedw-hc"
|
||||||
|
|
||||||
|
|
||||||
GOOGLE_TAG_MANAGER = GTM-T78CBC3
|
GOOGLE_TAG_MANAGER = GTM-T78CBC3
|
||||||
SHOWLOGIN = "true"
|
SHOWLOGIN = "false"
|
||||||
SHOWREPRESENTATIONS = "false"
|
SHOWREPRESENTATIONS = "false"
|
||||||
BASIC_AUTH_CREDENTIALS = pinswg:password|pinswg2:password2
|
BASIC_AUTH_CREDENTIALS = pinswg:password|pinswg2:password2
|
||||||
|
|
||||||
@@ -65,4 +66,6 @@ GG_REDIRECT_URI = "http://localhost:3000"
|
|||||||
NEXT_PUBLIC_GG_CLIENT_ID = 5vTukeSpN7d6uBV7YLb7A5wOctzzkZ
|
NEXT_PUBLIC_GG_CLIENT_ID = 5vTukeSpN7d6uBV7YLb7A5wOctzzkZ
|
||||||
NEXT_PUBLIC_GG_REDIRECT_URI = "http://localhost:3000"
|
NEXT_PUBLIC_GG_REDIRECT_URI = "http://localhost:3000"
|
||||||
|
|
||||||
|
API_ROOT = "http://localhost:3000/"
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+323
-522
File diff suppressed because it is too large
Load Diff
@@ -12,10 +12,10 @@ import CryptoJS from "crypto-js";
|
|||||||
import {
|
import {
|
||||||
getBasicSearch,
|
getBasicSearch,
|
||||||
getBasicSearchDetails,
|
getBasicSearchDetails,
|
||||||
getSearchDocumentDetails1,
|
getSearchDocumentDetails,
|
||||||
getSearchDocumentHistory1,
|
getSearchDocumentHistory,
|
||||||
getSearchDocumentHistory1Paged,
|
getSearchDocumentHistoryPaged,
|
||||||
getSearchDocumentDetails1Paged,
|
getSearchDocumentDetailsPaged,
|
||||||
getToken,
|
getToken,
|
||||||
} from "../../actions";
|
} from "../../actions";
|
||||||
|
|
||||||
@@ -105,9 +105,9 @@ const DocumentDetails = (props) => {
|
|||||||
>
|
>
|
||||||
<dd className="govuk-summary-list__value govuk-!-font-size-16 ">
|
<dd className="govuk-summary-list__value govuk-!-font-size-16 ">
|
||||||
<a
|
<a
|
||||||
href={encryptDocReference(
|
href={
|
||||||
detailsObj.pinswg_isharedocumentreference
|
detailsObj.pinswg_hashlink
|
||||||
)}
|
}
|
||||||
>
|
>
|
||||||
<span className="results-visually-hidden">
|
<span className="results-visually-hidden">
|
||||||
{t(
|
{t(
|
||||||
@@ -191,23 +191,9 @@ const DocumentDetails = (props) => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
const WORDKEY = process.env.NEXT_PUBLIC_HASHKEY;
|
|
||||||
|
|
||||||
const encryptDocReference = (documentRef) => {
|
|
||||||
var hashlink = CryptoJS.HmacSHA256(
|
|
||||||
"documents/download/" + documentRef,
|
|
||||||
CryptoJS.enc.Hex.parse(WORDKEY)
|
|
||||||
);
|
|
||||||
hashlink = hashlink.toString(CryptoJS.enc.Hex);
|
|
||||||
|
|
||||||
return (
|
|
||||||
"/api/proxy/documents/download/" + documentRef + "?hash=" + hashlink
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const docDetailsObj = async () => {
|
const docDetailsObj = async () => {
|
||||||
let docObj = await getSearchDocumentDetails1(incidentid)
|
let docObj = await getSearchDocumentDetails(incidentid)
|
||||||
.then((data) => {
|
.then((data) => {
|
||||||
//console.log(data);
|
//console.log(data);
|
||||||
setDocumentDetails(data);
|
setDocumentDetails(data);
|
||||||
@@ -239,7 +225,7 @@ const DocumentDetails = (props) => {
|
|||||||
console.log(historyDetail.pinswg_documentid);
|
console.log(historyDetail.pinswg_documentid);
|
||||||
} else {
|
} else {
|
||||||
historyArr.push(
|
historyArr.push(
|
||||||
getSearchDocumentHistory1(
|
getSearchDocumentHistory(
|
||||||
historyDetail.pinswg_documentid
|
historyDetail.pinswg_documentid
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
@@ -252,8 +238,7 @@ const DocumentDetails = (props) => {
|
|||||||
}, [incidentid, setDocumentHistory, setDocumentDetails]);
|
}, [incidentid, setDocumentHistory, setDocumentDetails]);
|
||||||
|
|
||||||
const getDocumentResults = (pageNumber) => {
|
const getDocumentResults = (pageNumber) => {
|
||||||
//console.log(advancedSearch, searchString, pageNumber);
|
getSearchDocumentDetailsPaged(incidentid, pageNumber)
|
||||||
getSearchDocumentDetails1Paged(incidentid, pageNumber)
|
|
||||||
.then((data) => {
|
.then((data) => {
|
||||||
//console.log(data);
|
//console.log(data);
|
||||||
setDocumentDetails(data);
|
setDocumentDetails(data);
|
||||||
@@ -269,10 +254,7 @@ const DocumentDetails = (props) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const getDocumentDetails = async () => {
|
const getDocumentDetails = async () => {
|
||||||
let docObj = await getSearchDocumentDetails1Paged(
|
let docObj = await getSearchDocumentDetailsPaged(incidentid, pageNumber)
|
||||||
incidentid,
|
|
||||||
pageNumber
|
|
||||||
)
|
|
||||||
.then((data) => {
|
.then((data) => {
|
||||||
//console.log(data);
|
//console.log(data);
|
||||||
setDocumentDetails(data);
|
setDocumentDetails(data);
|
||||||
@@ -303,7 +285,7 @@ const DocumentDetails = (props) => {
|
|||||||
console.log(historyDetail.pinswg_documentid);
|
console.log(historyDetail.pinswg_documentid);
|
||||||
} else {
|
} else {
|
||||||
historyArr.push(
|
historyArr.push(
|
||||||
getSearchDocumentHistory1Paged(
|
getSearchDocumentHistoryPaged(
|
||||||
historyDetail.pinswg_documentid,
|
historyDetail.pinswg_documentid,
|
||||||
pageNumber
|
pageNumber
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -73,12 +73,7 @@ const RepresentationList = (props) => {
|
|||||||
return (
|
return (
|
||||||
<div className="govuk-summary-list__row" key={key}>
|
<div className="govuk-summary-list__row" key={key}>
|
||||||
<dd className="govuk-summary-list__value govuk-!-font-size-16 ">
|
<dd className="govuk-summary-list__value govuk-!-font-size-16 ">
|
||||||
<a
|
<a href={detailsObj.pinswg_hashlink}>
|
||||||
href={
|
|
||||||
"/api/proxy/documents/download/" +
|
|
||||||
detailsObj.pinswg_isharedocumentreference
|
|
||||||
}
|
|
||||||
>
|
|
||||||
<span className="results-visually-hidden">
|
<span className="results-visually-hidden">
|
||||||
{t("case:documents-name-label")}:
|
{t("case:documents-name-label")}:
|
||||||
</span>
|
</span>
|
||||||
|
|||||||
@@ -207,7 +207,7 @@ let Login = (props) => {
|
|||||||
<h3 className="heading-small card-heading">
|
<h3 className="heading-small card-heading">
|
||||||
{t("home:login-card-title")}
|
{t("home:login-card-title")}
|
||||||
</h3>{" "}
|
</h3>{" "}
|
||||||
{/* <form onSubmit={handleSubmit(onHandleSubmit)}>
|
<form onSubmit={handleSubmit(onHandleSubmit)}>
|
||||||
{validLoginID == false && (
|
{validLoginID == false && (
|
||||||
<div className="govuk-error-message govuk-form-group--error">
|
<div className="govuk-error-message govuk-form-group--error">
|
||||||
Incorrect username or password
|
Incorrect username or password
|
||||||
@@ -254,7 +254,7 @@ let Login = (props) => {
|
|||||||
{t("home:login-card-button")}
|
{t("home:login-card-button")}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</form> */}
|
</form>
|
||||||
<div className="govuk-form-group govuk-!-margin-top-4">
|
<div className="govuk-form-group govuk-!-margin-top-4">
|
||||||
<p className="govuk-body-xs">
|
<p className="govuk-body-xs">
|
||||||
<a
|
<a
|
||||||
|
|||||||
@@ -260,7 +260,7 @@ const DNSSearchResults = (props) => {
|
|||||||
|
|
||||||
getBasicDNSSearchPaged(pageNumber)
|
getBasicDNSSearchPaged(pageNumber)
|
||||||
.then((data) => {
|
.then((data) => {
|
||||||
//console.log(data);
|
console.log(data);
|
||||||
setSearchResults(data);
|
setSearchResults(data);
|
||||||
return data;
|
return data;
|
||||||
})
|
})
|
||||||
|
|||||||
+9
-3
@@ -52,9 +52,15 @@ class MyDocument extends Document {
|
|||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{!process.browser && (
|
{!process.browser && (
|
||||||
<script>
|
<>
|
||||||
window.switchDomain = `{process.env.I18N_DOMAIN}`
|
<script>
|
||||||
</script>
|
window.switchDomain = `{process.env.I18N_DOMAIN}
|
||||||
|
`
|
||||||
|
</script>
|
||||||
|
<script>
|
||||||
|
window.apiRoot = `{process.env.API_ROOT}`
|
||||||
|
</script>
|
||||||
|
</>
|
||||||
)}
|
)}
|
||||||
<SkipLink />
|
<SkipLink />
|
||||||
<Main />
|
<Main />
|
||||||
|
|||||||
@@ -147,14 +147,14 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
|||||||
tokenExpiryTimeAt.getSeconds() + token.expires_in
|
tokenExpiryTimeAt.getSeconds() + token.expires_in
|
||||||
);
|
);
|
||||||
|
|
||||||
console.log(
|
// console.log(
|
||||||
"token issued:",
|
// "token issued:",
|
||||||
tokenIssuedAt.toUTCString(),
|
// tokenIssuedAt.toUTCString(),
|
||||||
"\n",
|
// "\n",
|
||||||
"token expires:",
|
// "token expires:",
|
||||||
tokenExpiryTimeAt.toUTCString()
|
// tokenExpiryTimeAt.toUTCString()
|
||||||
);
|
// );
|
||||||
console.log(token);
|
// console.log(token);
|
||||||
token = token.access_token;
|
token = token.access_token;
|
||||||
|
|
||||||
const [appealTypeData, lpaData] = await Promise.all([
|
const [appealTypeData, lpaData] = await Promise.all([
|
||||||
|
|||||||
@@ -0,0 +1,70 @@
|
|||||||
|
import axios from "axios";
|
||||||
|
import https from "https";
|
||||||
|
import CryptoJS from "crypto-js";
|
||||||
|
import { getToken } from "../../../../actions";
|
||||||
|
|
||||||
|
const WORDKEY = process.env.HASHKEY;
|
||||||
|
const accessTokenEndpoint = process.env.ACCESS_TOKEN_ENDPOINT;
|
||||||
|
const tenantId = process.env.TENANT;
|
||||||
|
|
||||||
|
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;
|
||||||
|
};
|
||||||
|
|
||||||
|
const azureHeadersPaged = (access_token) => {
|
||||||
|
return {
|
||||||
|
headers: {
|
||||||
|
"OData-MaxVersion": "4.0",
|
||||||
|
"OData-Version": "4.0",
|
||||||
|
"Accept": "application/json;odata.metadata=none",
|
||||||
|
"Prefer":
|
||||||
|
'odata.include-annotations="*",return=representation, odata.maxpagesize=10',
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
"Authorization": "Bearer " + access_token,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
export default async function ApiProxy(req, res) {
|
||||||
|
var token = await getToken();
|
||||||
|
|
||||||
|
var docRef = req.query;
|
||||||
|
|
||||||
|
console.log(docRef.id);
|
||||||
|
|
||||||
|
var queryUrl = "documents/download/" + docRef.id + "?hash=" + docRef.hash;
|
||||||
|
|
||||||
|
console.log(WEBAPI_URL + queryUrl);
|
||||||
|
return axios
|
||||||
|
.get(
|
||||||
|
WEBAPI_URL + queryUrl, // + hashAPIPath(queryUrl),
|
||||||
|
azureHeadersPaged(token.access_token)
|
||||||
|
)
|
||||||
|
.then((response) => {
|
||||||
|
console.log(response.headers);
|
||||||
|
res.status(200);
|
||||||
|
res.setHeader(
|
||||||
|
"Content-disposition",
|
||||||
|
"attachment; filename=" +
|
||||||
|
response.headers["content-disposition"].split(
|
||||||
|
"filename="
|
||||||
|
)[1]
|
||||||
|
);
|
||||||
|
res.end(response.data);
|
||||||
|
})
|
||||||
|
.catch(({ err }) => {
|
||||||
|
res.status(400).json(err);
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
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 =
|
||||||
|
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 token = await getToken();
|
||||||
|
var queryUrl = "contacts";
|
||||||
|
var data = JSON.stringify(req.body);
|
||||||
|
|
||||||
|
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,
|
||||||
|
};
|
||||||
|
|
||||||
|
return axios(config)
|
||||||
|
.then(({ data }) => {
|
||||||
|
console.log("deleted ");
|
||||||
|
res.status(200).json(data);
|
||||||
|
})
|
||||||
|
.catch(({ err }) => {
|
||||||
|
res.status(400).json(err);
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
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 =
|
||||||
|
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 token = await getToken();
|
||||||
|
var data = JSON.stringify(req.body);
|
||||||
|
var queryUrl = "pinswg_watchlists";
|
||||||
|
|
||||||
|
console.log("create case");
|
||||||
|
|
||||||
|
var config = {
|
||||||
|
method: "post",
|
||||||
|
url: queryUrl + hashAPIPath(queryUrl),
|
||||||
|
headers: {
|
||||||
|
"OData-MaxVersion": "4.0",
|
||||||
|
"OData-Version": "4.0",
|
||||||
|
"Accept": "application/json",
|
||||||
|
"Prefer": 'odata.include-annotations="*"',
|
||||||
|
"Authorization": "Bearer " + token.access_token,
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
},
|
||||||
|
data: data,
|
||||||
|
};
|
||||||
|
|
||||||
|
return axios(config)
|
||||||
|
.then(({ data }) => {
|
||||||
|
res.status(200).json(data);
|
||||||
|
})
|
||||||
|
.catch(({ err }) => {
|
||||||
|
res.status(400).json(err);
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
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 =
|
||||||
|
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 myRepresentationsID = req.query.myRepresentationsID;
|
||||||
|
var token = await getToken();
|
||||||
|
var queryUrl = "pinswg_representationses(" + myRepresentationsID + ")";
|
||||||
|
|
||||||
|
var config = {
|
||||||
|
method: "delete",
|
||||||
|
url: WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
||||||
|
headers: {
|
||||||
|
"OData-MaxVersion": "4.0",
|
||||||
|
"OData-Version": "4.0",
|
||||||
|
"Accept": "application/json",
|
||||||
|
"Prefer": 'odata.include-annotations="*"',
|
||||||
|
"Authorization": "Bearer " + token.access_token,
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
return axios(config)
|
||||||
|
.then(({ data }) => {
|
||||||
|
console.log("deleted ");
|
||||||
|
res.status(200).json(data);
|
||||||
|
})
|
||||||
|
.catch(({ err }) => {
|
||||||
|
res.status(400).json(err);
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
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 =
|
||||||
|
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 watchedCaseID = req.query.watchedCaseID;
|
||||||
|
var token = await getToken();
|
||||||
|
var queryUrl = "pinswg_watchlists(" + watchedCaseID + ")";
|
||||||
|
|
||||||
|
var config = {
|
||||||
|
method: "delete",
|
||||||
|
url: WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
||||||
|
headers: {
|
||||||
|
"OData-MaxVersion": "4.0",
|
||||||
|
"OData-Version": "4.0",
|
||||||
|
"Accept": "application/json",
|
||||||
|
"Prefer": 'odata.include-annotations="*"',
|
||||||
|
"Authorization": "Bearer " + token.access_token,
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
return axios(config)
|
||||||
|
.then(({ data }) => {
|
||||||
|
console.log("deleted ");
|
||||||
|
res.status(200).json(data);
|
||||||
|
})
|
||||||
|
.catch(({ err }) => {
|
||||||
|
res.status(400).json(err);
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -0,0 +1,72 @@
|
|||||||
|
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 =
|
||||||
|
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 searchString = req.query.searchstring;
|
||||||
|
var token = req.query.token;
|
||||||
|
|
||||||
|
searchString = JSON.parse(searchString);
|
||||||
|
|
||||||
|
var queryString = "";
|
||||||
|
|
||||||
|
queryString +=
|
||||||
|
searchString.q != null
|
||||||
|
? "(contains(title, '" +
|
||||||
|
searchString.q +
|
||||||
|
"') or contains(ticketnumber,'" +
|
||||||
|
searchString.q +
|
||||||
|
"'))"
|
||||||
|
: "";
|
||||||
|
|
||||||
|
queryString +=
|
||||||
|
searchString.lpa != null
|
||||||
|
? (typeof searchString.q == "undefined" ? "" : " and ") +
|
||||||
|
"_pinswg_associatedlpa_value eq " +
|
||||||
|
searchString.lpa
|
||||||
|
: "";
|
||||||
|
queryString +=
|
||||||
|
searchString.apt != null
|
||||||
|
? (typeof searchString.q == "undefined" &&
|
||||||
|
typeof searchString.lpa == "undefined"
|
||||||
|
? ""
|
||||||
|
: " and ") +
|
||||||
|
"pinswg_appealcasetype eq " +
|
||||||
|
searchString.apt
|
||||||
|
: "";
|
||||||
|
|
||||||
|
var queryUrl =
|
||||||
|
"incidents?$select=numberofchildincidents,_accountid_value,_customerid_value,_pinswg_associatedlpa_value,_ownerid_value,pinswg_appealcasetype,statuscode,ticketnumber,title, _primarycontactid_value&$expand=primarycontactid($select=fullname)&$filter=" +
|
||||||
|
queryString +
|
||||||
|
" and pinswg_appealcasetype ne null and pinswg_publishtoweb eq true&$orderby=createdon desc&$count=true";
|
||||||
|
|
||||||
|
return axios
|
||||||
|
.get(
|
||||||
|
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
||||||
|
azureHeadersPaged(token)
|
||||||
|
)
|
||||||
|
.then(({ data }) => {
|
||||||
|
res.status(200).json(data);
|
||||||
|
})
|
||||||
|
.catch(({ err }) => {
|
||||||
|
res.status(400).json(err);
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -0,0 +1,77 @@
|
|||||||
|
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 =
|
||||||
|
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 (hashPath.indexOf("?") > -1 ? "&hash=" : "?hash=") + hashlink;
|
||||||
|
};
|
||||||
|
|
||||||
|
export default async function ApiProxy(req, res) {
|
||||||
|
var searchString = req.query.searchstring;
|
||||||
|
var pageNumber = req.query.pageNumber;
|
||||||
|
var token = await getToken();
|
||||||
|
|
||||||
|
searchString = JSON.parse(searchString);
|
||||||
|
|
||||||
|
var queryString = "";
|
||||||
|
|
||||||
|
queryString +=
|
||||||
|
searchString.q != null
|
||||||
|
? "(contains(title, '" +
|
||||||
|
searchString.q +
|
||||||
|
"') or contains(ticketnumber,'" +
|
||||||
|
searchString.q +
|
||||||
|
"'))"
|
||||||
|
: "";
|
||||||
|
|
||||||
|
queryString +=
|
||||||
|
searchString.lpa != null
|
||||||
|
? (typeof searchString.q == "undefined" ? "" : " and ") +
|
||||||
|
"_pinswg_associatedlpa_value eq " +
|
||||||
|
searchString.lpa
|
||||||
|
: "";
|
||||||
|
queryString +=
|
||||||
|
searchString.apt != null
|
||||||
|
? (typeof searchString.q == "undefined" &&
|
||||||
|
typeof searchString.lpa == "undefined"
|
||||||
|
? ""
|
||||||
|
: " and ") +
|
||||||
|
"pinswg_appealcasetype eq " +
|
||||||
|
searchString.apt
|
||||||
|
: "";
|
||||||
|
|
||||||
|
var queryUrl =
|
||||||
|
"incidents?$select=numberofchildincidents,_accountid_value,_customerid_value,_pinswg_associatedlpa_value,_ownerid_value,pinswg_appealcasetype,statuscode,ticketnumber,title, _primarycontactid_value&$expand=primarycontactid($select=fullname)&$filter=" +
|
||||||
|
queryString +
|
||||||
|
" and pinswg_appealcasetype ne null and pinswg_publishtoweb eq true&$orderby=createdon desc&$count=true" +
|
||||||
|
(typeof pageNumber != "undefined"
|
||||||
|
? "&$skiptoken=" + ('<cookie pagenumber="' + pageNumber + '" />')
|
||||||
|
: "");
|
||||||
|
|
||||||
|
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);
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
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 =
|
||||||
|
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 (queryPath.indexOf("?") > -1 ? "&hash=" : "?hash=") + hashlink;
|
||||||
|
};
|
||||||
|
|
||||||
|
export default async function ApiProxy(req, res) {
|
||||||
|
var caseReference = req.query.caseReference;
|
||||||
|
var updateFormCollection = req.query.updateFormCollection;
|
||||||
|
var primaryAttribute = req.query.primaryAttribute;
|
||||||
|
var token = await getToken();
|
||||||
|
|
||||||
|
const queryUrl =
|
||||||
|
updateFormCollection +
|
||||||
|
"?$count=true&$select=_" +
|
||||||
|
primaryAttribute +
|
||||||
|
"s_value&$filter=pinswg_name eq '" +
|
||||||
|
caseReference +
|
||||||
|
"'";
|
||||||
|
|
||||||
|
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);
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
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 =
|
||||||
|
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 token = req.query.token;
|
||||||
|
|
||||||
|
var queryUrl =
|
||||||
|
"stringmaps?$filter=objecttypecode eq 'incident' and attributename eq 'pinswg_appealcasetype' and value ne 'LDP' and value ne 'Misc Casework'&$count=true&$select=value,stringmapid,organizationid,attributevalue&$orderby=value asc";
|
||||||
|
|
||||||
|
return axios
|
||||||
|
.get(WEBAPI_URL + queryUrl + hashAPIPath(queryUrl), azureHeaders(token))
|
||||||
|
.then(({ data }) => {
|
||||||
|
res.status(200).json(data);
|
||||||
|
})
|
||||||
|
.catch(({ err }) => {
|
||||||
|
res.status(400).json(err);
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
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 =
|
||||||
|
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 token = req.query.token;
|
||||||
|
|
||||||
|
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";
|
||||||
|
|
||||||
|
console.log(WEBAPI_URL + queryUrl + hashAPIPath(queryUrl));
|
||||||
|
|
||||||
|
return axios
|
||||||
|
.get(
|
||||||
|
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
||||||
|
azureHeadersPaged(token)
|
||||||
|
)
|
||||||
|
.then(({ data }) => {
|
||||||
|
res.status(200).json(data);
|
||||||
|
})
|
||||||
|
.catch(({ err }) => {
|
||||||
|
res.status(400).json(err);
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
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 =
|
||||||
|
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 caseReference = req.query.caseReference;
|
||||||
|
var token = req.query.token;
|
||||||
|
|
||||||
|
var queryUrl =
|
||||||
|
"pinswg_dnses?$filter=pinswg_name eq '" +
|
||||||
|
caseReference +
|
||||||
|
"'&$count=true";
|
||||||
|
|
||||||
|
return axios
|
||||||
|
.get(
|
||||||
|
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
||||||
|
azureHeadersPaged(token)
|
||||||
|
)
|
||||||
|
.then(({ data }) => {
|
||||||
|
res.status(200).json(data);
|
||||||
|
})
|
||||||
|
.catch(({ err }) => {
|
||||||
|
res.status(400).json(err);
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
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 =
|
||||||
|
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 caseReference = req.query.caseReference;
|
||||||
|
var token = await getToken();
|
||||||
|
|
||||||
|
var queryUrl =
|
||||||
|
"pinswg_dnses?$filter=pinswg_name eq '" +
|
||||||
|
caseReference +
|
||||||
|
"'&$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);
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
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 =
|
||||||
|
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;
|
||||||
|
//console.log(hashlink);
|
||||||
|
return (queryPath.indexOf("?") > -1 ? "&hash=" : "?hash=") + hashlink;
|
||||||
|
};
|
||||||
|
|
||||||
|
export default async function ApiProxy(req, res) {
|
||||||
|
var pageNumber = req.query.pageNumber;
|
||||||
|
var token = await getToken();
|
||||||
|
|
||||||
|
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" +
|
||||||
|
(typeof pageNumber != "undefined"
|
||||||
|
? "&$skiptoken=" + '<cookie pagenumber="' + pageNumber + '" />'
|
||||||
|
: "");
|
||||||
|
|
||||||
|
console.log(WEBAPI_URL + queryUrl + hashAPIPath(queryUrl));
|
||||||
|
|
||||||
|
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);
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
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 =
|
||||||
|
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 searchString = req.query.searchString;
|
||||||
|
var token = req.query.token;
|
||||||
|
|
||||||
|
var queryUrl =
|
||||||
|
"incidents?$select=numberofchildincidents,_accountid_value,_customerid_value,_pinswg_associatedlpa_value,_ownerid_value,pinswg_appealcasetype,statuscode,ticketnumber,title, _primarycontactid_value&$expand=primarycontactid($select=fullname)&$filter=(contains(title, '" +
|
||||||
|
searchString +
|
||||||
|
"') or contains(ticketnumber, '" +
|
||||||
|
searchString +
|
||||||
|
"')) and pinswg_appealcasetype ne null and pinswg_publishtoweb eq true&$orderby=createdon desc&$count=true";
|
||||||
|
|
||||||
|
return axios
|
||||||
|
.get(
|
||||||
|
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
||||||
|
azureHeadersPaged(token)
|
||||||
|
)
|
||||||
|
.then(({ data }) => {
|
||||||
|
res.status(200).json(data);
|
||||||
|
})
|
||||||
|
.catch(({ err }) => {
|
||||||
|
res.status(400).json(err);
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
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 =
|
||||||
|
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 appealTypeName = req.query.appealTypeName;
|
||||||
|
var primaryIdAttribute = req.query.primaryIdAttribute;
|
||||||
|
var incidentID = req.query.incidentID;
|
||||||
|
var token = req.query.token;
|
||||||
|
|
||||||
|
var queryUrl =
|
||||||
|
appealTypeName +
|
||||||
|
"?$filter=_" +
|
||||||
|
primaryIdAttribute +
|
||||||
|
"s_value eq " +
|
||||||
|
incidentID +
|
||||||
|
"&$count=true";
|
||||||
|
|
||||||
|
return axios
|
||||||
|
.get(
|
||||||
|
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
||||||
|
azureHeadersPaged(token)
|
||||||
|
)
|
||||||
|
.then(({ data }) => {
|
||||||
|
res.status(200).json(data);
|
||||||
|
})
|
||||||
|
.catch(({ err }) => {
|
||||||
|
res.status(400).json(err);
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
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 =
|
||||||
|
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 appealTypeName = req.query.appealTypeName;
|
||||||
|
var primaryIdAttribute = req.query.primaryIdAttribute;
|
||||||
|
var incidentID = req.query.incidentID;
|
||||||
|
var token = await getToken();
|
||||||
|
|
||||||
|
var queryUrl =
|
||||||
|
appealTypeName +
|
||||||
|
"?$filter=_" +
|
||||||
|
primaryIdAttribute +
|
||||||
|
"s_value eq " +
|
||||||
|
incidentID +
|
||||||
|
"&$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);
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
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 =
|
||||||
|
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 (queryPath.indexOf("?") > -1 ? "&hash=" : "?hash=") + hashlink;
|
||||||
|
};
|
||||||
|
|
||||||
|
export default async function ApiProxy(req, res) {
|
||||||
|
var searchString = req.query.searchString;
|
||||||
|
var pageNumber = req.query.pageNumber;
|
||||||
|
var token = await getToken();
|
||||||
|
|
||||||
|
var queryUrl =
|
||||||
|
"incidents?$select=numberofchildincidents,_accountid_value,_customerid_value,_pinswg_associatedlpa_value,_ownerid_value,pinswg_appealcasetype,statuscode,ticketnumber,title, _primarycontactid_value&$expand=primarycontactid($select=fullname)&$filter=(contains(title, '" +
|
||||||
|
searchString +
|
||||||
|
"') or contains(ticketnumber, '" +
|
||||||
|
searchString +
|
||||||
|
"')) and pinswg_appealcasetype ne null and pinswg_publishtoweb eq true&$orderby=createdon desc&$count=true" +
|
||||||
|
(typeof pageNumber != "undefined"
|
||||||
|
? "&$skiptoken=" + '<cookie pagenumber="' + pageNumber + '" />'
|
||||||
|
: "");
|
||||||
|
|
||||||
|
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);
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
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 =
|
||||||
|
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 (queryPath.indexOf("?") > -1 ? "&hash=" : "?hash=") + hashlink;
|
||||||
|
};
|
||||||
|
|
||||||
|
export default async function ApiProxy(req, res) {
|
||||||
|
var emailAddress = req.query.emailAddress;
|
||||||
|
var token = await getToken();
|
||||||
|
|
||||||
|
var queryUrl =
|
||||||
|
"contacts?$filter=emailaddress1 eq '" +
|
||||||
|
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);
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
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 =
|
||||||
|
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 parentIncidentid = req.query.parentincidentid;
|
||||||
|
var token = await getToken();
|
||||||
|
|
||||||
|
var queryUrl =
|
||||||
|
"incidents?$count=true&$filter=_parentcaseid_value eq " +
|
||||||
|
parentIncidentid +
|
||||||
|
" and pinswg_appealcasetype ne null and pinswg_publishtoweb eq true &$select=title, incidentid";
|
||||||
|
|
||||||
|
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);
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
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 =
|
||||||
|
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 (queryPath.indexOf("?") > -1 ? "&hash=" : "?hash=") + hashlink;
|
||||||
|
};
|
||||||
|
|
||||||
|
export default async function ApiProxy(req, res) {
|
||||||
|
var emailAddress = req.query.emailAddress;
|
||||||
|
var pwd = req.query.pwd;
|
||||||
|
var token = await getToken();
|
||||||
|
|
||||||
|
var queryUrl =
|
||||||
|
"contacts?$filter=emailaddress1 eq '" +
|
||||||
|
emailAddress +
|
||||||
|
"' and pinswg_custom_password eq '" +
|
||||||
|
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);
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
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 =
|
||||||
|
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 token = req.query.token;
|
||||||
|
|
||||||
|
var queryUrl =
|
||||||
|
"accounts?$count=true&$filter=pinswg_isalocalplanningauthorityaccount eq 846040000&$select=name&$orderby=name asc";
|
||||||
|
|
||||||
|
return axios
|
||||||
|
.get(WEBAPI_URL + queryUrl + hashAPIPath(queryUrl), azureHeaders(token))
|
||||||
|
.then(({ data }) => {
|
||||||
|
res.status(200).json(data);
|
||||||
|
})
|
||||||
|
.catch(({ err }) => {
|
||||||
|
res.status(400).json(err);
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
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 =
|
||||||
|
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 (queryPath.indexOf("?") > -1 ? "&hash=" : "?hash=") + hashlink;
|
||||||
|
};
|
||||||
|
|
||||||
|
export default async function ApiProxy(req, res) {
|
||||||
|
var loggedInUserId = req.query.loggedInUserId;
|
||||||
|
var token = req.query.token;
|
||||||
|
|
||||||
|
var queryUrl =
|
||||||
|
"incidents?$select=ticketnumber,casetypecode,createdon,_customerid_value,description,incidentid,pinswg_appealcasetype,_pinswg_assignedinspectrids_value,statecode,statuscode,title&$filter=_customerid_value eq " +
|
||||||
|
loggedInUserId +
|
||||||
|
" and pinswg_appealcasetype ne null&$orderby=createdon desc&$count=true&$top=3";
|
||||||
|
|
||||||
|
return axios
|
||||||
|
.get(WEBAPI_URL + queryUrl + hashAPIPath(queryUrl), azureHeaders(token))
|
||||||
|
.then(({ data }) => {
|
||||||
|
res.status(200).json(data);
|
||||||
|
})
|
||||||
|
.catch(({ err }) => {
|
||||||
|
res.status(400).json(err);
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
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 =
|
||||||
|
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 (queryPath.indexOf("?") > -1 ? "&hash=" : "?hash=") + hashlink;
|
||||||
|
};
|
||||||
|
|
||||||
|
export default async function ApiProxy(req, res) {
|
||||||
|
var loggedInUserId = req.query.loggedInUserId;
|
||||||
|
var token = req.query.token;
|
||||||
|
|
||||||
|
var queryUrl =
|
||||||
|
"pinswg_representationses?$filter= _pinswg_contact_value eq " +
|
||||||
|
loggedInUserId +
|
||||||
|
"&$count=true&$orderby=createdon desc";
|
||||||
|
|
||||||
|
return axios
|
||||||
|
.get(WEBAPI_URL + queryUrl + hashAPIPath(queryUrl), azureHeaders(token))
|
||||||
|
.then(({ data }) => {
|
||||||
|
res.status(200).json(data);
|
||||||
|
})
|
||||||
|
.catch(({ err }) => {
|
||||||
|
res.status(400).json(err);
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
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 =
|
||||||
|
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 (queryPath.indexOf("?") > -1 ? "&hash=" : "?hash=") + hashlink;
|
||||||
|
};
|
||||||
|
|
||||||
|
export default async function ApiProxy(req, res) {
|
||||||
|
var loggedInUserId = req.query.loggedInUserId;
|
||||||
|
var token = req.query.token;
|
||||||
|
|
||||||
|
var queryUrl =
|
||||||
|
"pinswg_representationses?$filter= _pinswg_contact_value eq " +
|
||||||
|
loggedInUserId +
|
||||||
|
"&$count=true&$orderby=createdon desc";
|
||||||
|
|
||||||
|
return axios
|
||||||
|
.get(WEBAPI_URL + queryUrl + hashAPIPath(queryUrl), azureHeaders(token))
|
||||||
|
.then(({ data }) => {
|
||||||
|
res.status(200).json(data);
|
||||||
|
})
|
||||||
|
.catch(({ err }) => {
|
||||||
|
res.status(400).json(err);
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
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 =
|
||||||
|
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 (queryPath.indexOf("?") > -1 ? "&hash=" : "?hash=") + hashlink;
|
||||||
|
};
|
||||||
|
|
||||||
|
export default async function ApiProxy(req, res) {
|
||||||
|
var contactid = req.query.contactid;
|
||||||
|
var token = req.query.token;
|
||||||
|
|
||||||
|
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))
|
||||||
|
.then(({ data }) => {
|
||||||
|
res.status(200).json(data);
|
||||||
|
})
|
||||||
|
.catch(({ err }) => {
|
||||||
|
res.status(400).json(err);
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
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 =
|
||||||
|
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 (queryPath.indexOf("?") > -1 ? "&hash=" : "?hash=") + hashlink;
|
||||||
|
};
|
||||||
|
|
||||||
|
export default async function ApiProxy(req, res) {
|
||||||
|
var appealType = req.query.appealType;
|
||||||
|
var caseReference = req.query.caseReference;
|
||||||
|
var token = req.query.token;
|
||||||
|
|
||||||
|
var queryUrl =
|
||||||
|
appealType +
|
||||||
|
"?$filter=pinswg_name eq '" +
|
||||||
|
caseReference +
|
||||||
|
"'&$count=true";
|
||||||
|
|
||||||
|
return axios
|
||||||
|
.get(WEBAPI_URL + queryUrl + hashAPIPath(queryUrl), azureHeaders(token))
|
||||||
|
.then(({ data }) => {
|
||||||
|
res.status(200).json(data);
|
||||||
|
})
|
||||||
|
.catch(({ err }) => {
|
||||||
|
res.status(400).json(err);
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
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 =
|
||||||
|
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 (queryPath.indexOf("?") > -1 ? "&hash=" : "?hash=") + hashlink;
|
||||||
|
};
|
||||||
|
|
||||||
|
export default async function ApiProxy(req, res) {
|
||||||
|
var appealType = req.query.appealType;
|
||||||
|
var caseReference = req.query.caseReference;
|
||||||
|
var token = await getToken();
|
||||||
|
|
||||||
|
var queryUrl =
|
||||||
|
appealType +
|
||||||
|
"?$filter=pinswg_name eq '" +
|
||||||
|
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);
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
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 =
|
||||||
|
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 (queryPath.indexOf("?") > -1 ? "&hash=" : "?hash=") + hashlink;
|
||||||
|
};
|
||||||
|
|
||||||
|
export default async function ApiProxy(req, res) {
|
||||||
|
var loggedInUserId = req.query.loggedInUserId;
|
||||||
|
var token = await getToken();
|
||||||
|
|
||||||
|
var queryUrl =
|
||||||
|
"pinswg_representationses?$filter= _pinswg_case_value eq " +
|
||||||
|
incidentID +
|
||||||
|
" and pinswg_publishtoweb eq true&$count=true&$orderby=createdon desc";
|
||||||
|
|
||||||
|
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);
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
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 =
|
||||||
|
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 (queryPath.indexOf("?") > -1 ? "&hash=" : "?hash=") + hashlink;
|
||||||
|
};
|
||||||
|
|
||||||
|
export default async function ApiProxy(req, res) {
|
||||||
|
var incidentID = req.query.incidentID;
|
||||||
|
var token = req.query.token;
|
||||||
|
|
||||||
|
var queryUrl =
|
||||||
|
"pinswg_representationses?$filter= _pinswg_case_value eq " +
|
||||||
|
incidentID +
|
||||||
|
"&$count=true&$orderby=createdon desc";
|
||||||
|
|
||||||
|
return axios
|
||||||
|
.get(WEBAPI_URL + queryUrl + hashAPIPath(queryUrl), azureHeaders(token))
|
||||||
|
.then(({ data }) => {
|
||||||
|
res.status(200).json(data);
|
||||||
|
})
|
||||||
|
.catch(({ err }) => {
|
||||||
|
res.status(400).json(err);
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -0,0 +1,64 @@
|
|||||||
|
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 =
|
||||||
|
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;
|
||||||
|
};
|
||||||
|
|
||||||
|
const encryptDocReference = (documentRef) => {
|
||||||
|
var hashlink = CryptoJS.HmacSHA256(
|
||||||
|
"documents/download/" + documentRef,
|
||||||
|
CryptoJS.enc.Hex.parse(WORDKEY)
|
||||||
|
);
|
||||||
|
hashlink = hashlink.toString(CryptoJS.enc.Hex);
|
||||||
|
|
||||||
|
var hashStr =
|
||||||
|
"/api/documents/download/" + documentRef + "?hash=" + hashlink;
|
||||||
|
|
||||||
|
return hashStr;
|
||||||
|
};
|
||||||
|
|
||||||
|
export default async function ApiProxy(req, res) {
|
||||||
|
var incidentID = req.query.incidentid;
|
||||||
|
var token = await getToken();
|
||||||
|
|
||||||
|
var queryUrl =
|
||||||
|
"pinswg_documents?$count=true&$filter=pinswg_publishtoweb eq true and _pinswg_documentids_value eq " +
|
||||||
|
incidentID +
|
||||||
|
"&$select=pinswg_isharedocumentlocations,_pinswg_documentids_value,pinswg_isharelabelcasetype,pinswg_isharelabellpaname,pinswg_publishtoweb,pinswg_uploadstatus,pinswg_isharedocumentclassification,pinswg_isharedocumentreference";
|
||||||
|
|
||||||
|
return axios
|
||||||
|
.get(
|
||||||
|
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
||||||
|
azureHeadersPaged(token.access_token)
|
||||||
|
)
|
||||||
|
.then(({ data }) => {
|
||||||
|
data.value.forEach(function (element) {
|
||||||
|
element.pinswg_hashlink = encryptDocReference(
|
||||||
|
element.pinswg_isharedocumentreference
|
||||||
|
);
|
||||||
|
});
|
||||||
|
//console.log("details data:", data);
|
||||||
|
|
||||||
|
res.status(200).json(data);
|
||||||
|
})
|
||||||
|
.catch(({ err }) => {
|
||||||
|
res.status(400).json(err);
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -0,0 +1,67 @@
|
|||||||
|
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 =
|
||||||
|
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;
|
||||||
|
};
|
||||||
|
|
||||||
|
const encryptDocReference = (documentRef) => {
|
||||||
|
var hashlink = CryptoJS.HmacSHA256(
|
||||||
|
"documents/download/" + documentRef,
|
||||||
|
CryptoJS.enc.Hex.parse(WORDKEY)
|
||||||
|
);
|
||||||
|
hashlink = hashlink.toString(CryptoJS.enc.Hex);
|
||||||
|
|
||||||
|
var hashStr =
|
||||||
|
"/api/documents/download/" + documentRef + "?hash=" + hashlink;
|
||||||
|
|
||||||
|
return hashStr;
|
||||||
|
};
|
||||||
|
|
||||||
|
export default async function ApiProxy(req, res) {
|
||||||
|
var pageNumber = req.query.pageNumber;
|
||||||
|
var incidentID = req.query.incidentid;
|
||||||
|
var token = await getToken();
|
||||||
|
|
||||||
|
var queryUrl =
|
||||||
|
"pinswg_documents?$count=true&$filter=pinswg_publishtoweb eq true and _pinswg_documentids_value eq " +
|
||||||
|
incidentID +
|
||||||
|
"&$select=pinswg_isharedocumentlocations,_pinswg_documentids_value,pinswg_isharelabelcasetype,pinswg_isharelabellpaname,pinswg_publishtoweb,pinswg_uploadstatus,pinswg_isharedocumentclassification,pinswg_isharedocumentreference" +
|
||||||
|
(typeof pageNumber != "undefined"
|
||||||
|
? "&$skiptoken=" + ('<cookie pagenumber="' + pageNumber + '" />')
|
||||||
|
: "");
|
||||||
|
|
||||||
|
return axios
|
||||||
|
.get(
|
||||||
|
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
||||||
|
azureHeadersPaged(token.access_token)
|
||||||
|
)
|
||||||
|
.then(({ data }) => {
|
||||||
|
data.value.forEach(function (element) {
|
||||||
|
element.pinswg_hashlink = encryptDocReference(
|
||||||
|
element.pinswg_isharedocumentreference
|
||||||
|
);
|
||||||
|
});
|
||||||
|
//console.log("details paged data:", data);
|
||||||
|
res.status(200).json(data);
|
||||||
|
})
|
||||||
|
.catch(({ err }) => {
|
||||||
|
res.status(400).json(err);
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
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 =
|
||||||
|
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 documentID = req.query.documentid;
|
||||||
|
var token = await getToken();
|
||||||
|
|
||||||
|
var queryUrl =
|
||||||
|
"pinswg_documenthistories?$count=true&$select=_pinswg_documentid_value,pinswg_createddate,pinswg_state,pinswg_fileexists,statecode,pinswg_publisheddate&$filter=_pinswg_documentid_value eq " +
|
||||||
|
documentID;
|
||||||
|
|
||||||
|
return axios
|
||||||
|
.get(
|
||||||
|
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
||||||
|
azureHeadersPaged(token.access_token)
|
||||||
|
)
|
||||||
|
.then(({ data }) => {
|
||||||
|
res.status(200).json(data);
|
||||||
|
})
|
||||||
|
.catch(({ err }) => {
|
||||||
|
res.status(400).json(err);
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
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 =
|
||||||
|
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 documentID = req.query.documentid;
|
||||||
|
var pageNumber = req.query.pageNumber;
|
||||||
|
var token = await getToken();
|
||||||
|
|
||||||
|
var queryUrl =
|
||||||
|
"pinswg_documenthistories?$count=true&$select=_pinswg_documentid_value,pinswg_createddate,pinswg_state,pinswg_fileexists,statecode,pinswg_publisheddate&$filter=_pinswg_documentid_value eq " +
|
||||||
|
documentID;
|
||||||
|
// +
|
||||||
|
// (typeof pageNumber != "undefined"
|
||||||
|
// ? "&$skiptoken=" + ('<cookie pagenumber="' + pageNumber + '" />')
|
||||||
|
// : "");
|
||||||
|
|
||||||
|
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);
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
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 =
|
||||||
|
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 (queryPath.indexOf("?") > -1 ? "&hash=" : "?hash=") + hashlink;
|
||||||
|
};
|
||||||
|
|
||||||
|
export default async function ApiProxy(req, res) {
|
||||||
|
var loggedInUserId = req.query.loggedInUserId;
|
||||||
|
var token = req.query.token;
|
||||||
|
|
||||||
|
var queryUrl =
|
||||||
|
"pinswg_watchlists?$filter= _pinswg_contact_value eq " +
|
||||||
|
loggedInUserId +
|
||||||
|
"&$count=true&$orderby=createdon desc";
|
||||||
|
|
||||||
|
return axios
|
||||||
|
.get(WEBAPI_URL + queryUrl + hashAPIPath(queryUrl), azureHeaders(token))
|
||||||
|
.then(({ data }) => {
|
||||||
|
res.status(200).json(data);
|
||||||
|
})
|
||||||
|
.catch(({ err }) => {
|
||||||
|
res.status(400).json(err);
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
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 =
|
||||||
|
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 (queryPath.indexOf("?") > -1 ? "&hash=" : "?hash=") + hashlink;
|
||||||
|
};
|
||||||
|
|
||||||
|
export default async function ApiProxy(req, res) {
|
||||||
|
var loggedInUserId = req.query.loggedInUserId;
|
||||||
|
var token = req.query.token;
|
||||||
|
|
||||||
|
var queryUrl =
|
||||||
|
"pinswg_watchlists?$filter= _pinswg_contact_value eq " +
|
||||||
|
loggedInUserId +
|
||||||
|
"&$count=true&$orderby=createdon desc";
|
||||||
|
|
||||||
|
return axios
|
||||||
|
.get(WEBAPI_URL + queryUrl + hashAPIPath(queryUrl), azureHeaders(token))
|
||||||
|
.then(({ data }) => {
|
||||||
|
res.status(200).json(data);
|
||||||
|
})
|
||||||
|
.catch(({ err }) => {
|
||||||
|
res.status(400).json(err);
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
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 =
|
||||||
|
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 (queryPath.indexOf("?") > -1 ? "&hash=" : "?hash=") + hashlink;
|
||||||
|
};
|
||||||
|
|
||||||
|
export default async function ApiProxy(req, res) {
|
||||||
|
var loggedInUserId = req.query.loggedInUserId;
|
||||||
|
var token = await getToken();
|
||||||
|
|
||||||
|
var queryUrl =
|
||||||
|
"pinswg_watchlists?$filter= _pinswg_contact_value eq " +
|
||||||
|
loggedInUserId +
|
||||||
|
"&$count=true&$orderby=createdon desc";
|
||||||
|
|
||||||
|
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);
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
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 =
|
||||||
|
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 token = await getToken();
|
||||||
|
var data = JSON.stringify(req.body);
|
||||||
|
var queryUrl = "contacts(" + contactId + ")";
|
||||||
|
|
||||||
|
var config = {
|
||||||
|
method: "patch",
|
||||||
|
url: WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
||||||
|
headers: {
|
||||||
|
"OData-MaxVersion": "4.0",
|
||||||
|
"OData-Version": "4.0",
|
||||||
|
"Accept": "application/json",
|
||||||
|
"Prefer": 'odata.include-annotations="*"',
|
||||||
|
"Authorization": "Bearer " + token.access_token,
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
},
|
||||||
|
data: data,
|
||||||
|
};
|
||||||
|
|
||||||
|
return axios(config)
|
||||||
|
.then(({ data }) => {
|
||||||
|
res.status(200).json(data);
|
||||||
|
})
|
||||||
|
.catch(({ err }) => {
|
||||||
|
res.status(400).json(err);
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
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 =
|
||||||
|
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 data = JSON.stringify(req.body);
|
||||||
|
var appealObj = rea.query.appealObj;
|
||||||
|
var updateFormCollection = req.query.updateFormCollection;
|
||||||
|
var queryUrl = updateFormCollection + "(" + appealObj + ")";
|
||||||
|
|
||||||
|
var token = await getToken();
|
||||||
|
|
||||||
|
var config = {
|
||||||
|
method: "patch",
|
||||||
|
url: WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
||||||
|
headers: {
|
||||||
|
"OData-MaxVersion": "4.0",
|
||||||
|
"OData-Version": "4.0",
|
||||||
|
"Accept": "application/json",
|
||||||
|
"Prefer": 'odata.include-annotations="*"',
|
||||||
|
"Authorization": "Bearer " + token.access_token,
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
},
|
||||||
|
data: data,
|
||||||
|
};
|
||||||
|
|
||||||
|
return axios(config)
|
||||||
|
.then(({ data }) => {
|
||||||
|
res.status(200).json(data);
|
||||||
|
})
|
||||||
|
.catch(({ err }) => {
|
||||||
|
res.status(400).json(err);
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
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 =
|
||||||
|
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 token = await getToken();
|
||||||
|
var data = JSON.stringify(req.body);
|
||||||
|
var queryUrl = "contacts(" + contactId + ")";
|
||||||
|
|
||||||
|
var config = {
|
||||||
|
method: "patch",
|
||||||
|
url: WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
||||||
|
headers: {
|
||||||
|
"OData-MaxVersion": "4.0",
|
||||||
|
"OData-Version": "4.0",
|
||||||
|
"Accept": "application/json",
|
||||||
|
"Prefer": 'odata.include-annotations="*"',
|
||||||
|
"Authorization": "Bearer " + token.access_token,
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
},
|
||||||
|
data: data,
|
||||||
|
};
|
||||||
|
|
||||||
|
return axios(config)
|
||||||
|
.then(({ data }) => {
|
||||||
|
res.status(200).json(data);
|
||||||
|
})
|
||||||
|
.catch(({ err }) => {
|
||||||
|
res.status(400).json(err);
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -1,195 +0,0 @@
|
|||||||
import axios from "axios";
|
|
||||||
import https from "https";
|
|
||||||
import CryptoJS from "crypto-js";
|
|
||||||
import HmacSHA256 from "crypto-js/hmac-sha256";
|
|
||||||
import { rest } from "lodash";
|
|
||||||
|
|
||||||
const PROXY_RELAY_URL =
|
|
||||||
"https://" +
|
|
||||||
(process.env.RELAYURI || "dev-pedw-ns.servicebus.windows.net") +
|
|
||||||
"/" +
|
|
||||||
(process.env.RELAYPATH || "dev-pedw-hc") +
|
|
||||||
"/";
|
|
||||||
|
|
||||||
const accessTokenEndpoint = process.env.ACCESS_TOKEN_ENDPOINT;
|
|
||||||
const tenantId = process.env.TENANT;
|
|
||||||
|
|
||||||
const tokenBody =
|
|
||||||
"grant_type=" +
|
|
||||||
process.env.GRANT_TYPE +
|
|
||||||
"&client_id=" +
|
|
||||||
process.env.CLIENT_ID +
|
|
||||||
"&client_secret=" +
|
|
||||||
process.env.CLIENT_SECRET +
|
|
||||||
"&scope=" +
|
|
||||||
"https://" +
|
|
||||||
process.env.RELAYURI +
|
|
||||||
"/.default";
|
|
||||||
|
|
||||||
const tokenConfig = {
|
|
||||||
headers: {
|
|
||||||
"Content-Type": "application/x-www-form-urlencoded",
|
|
||||||
"Cache-Control": "no-cache",
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
export const getToken = () => {
|
|
||||||
return axios
|
|
||||||
.post(
|
|
||||||
`${accessTokenEndpoint}${tenantId}/oauth2/v2.0/token`,
|
|
||||||
tokenBody,
|
|
||||||
tokenConfig
|
|
||||||
)
|
|
||||||
.then((res) => res.data)
|
|
||||||
.then((data) => {
|
|
||||||
return data;
|
|
||||||
})
|
|
||||||
.catch((error) => {
|
|
||||||
console.log("error :", error.response);
|
|
||||||
// return error;
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
function checkProxyPath(queryPath) {
|
|
||||||
const WORDKEY = process.env.NEXT_PUBLIC_HASHKEY;
|
|
||||||
|
|
||||||
var hashPath =
|
|
||||||
queryPath.indexOf("/api/proxy/") == -1
|
|
||||||
? queryPath
|
|
||||||
: queryPath.split("/api/proxy/")[1];
|
|
||||||
|
|
||||||
const wordKey = WORDKEY;
|
|
||||||
var hashlink = CryptoJS.HmacSHA256(
|
|
||||||
decodeURI(hashPath),
|
|
||||||
CryptoJS.enc.Hex.parse(wordKey)
|
|
||||||
);
|
|
||||||
|
|
||||||
hashlink = hashlink.toString(CryptoJS.enc.Hex);
|
|
||||||
|
|
||||||
return hashlink;
|
|
||||||
}
|
|
||||||
|
|
||||||
export default async function ApiProxy(req, res) {
|
|
||||||
var data = req.body; //JSON.stringify(req.body);
|
|
||||||
var accessToken = await getToken();
|
|
||||||
accessToken = accessToken.access_token;
|
|
||||||
|
|
||||||
const isDocument = req.url.indexOf("/documents/download") > -1;
|
|
||||||
|
|
||||||
let hashCheckPath =
|
|
||||||
req.url.indexOf("?hash=") > -1
|
|
||||||
? req.url.split("?hash=")[0]
|
|
||||||
: req.url.split("&hash=")[0];
|
|
||||||
|
|
||||||
let hashCheckValue =
|
|
||||||
req.url.indexOf("?hash=") > -1
|
|
||||||
? req.url.split("?hash=")[1]
|
|
||||||
: req.url.split("&hash=")[1];
|
|
||||||
|
|
||||||
let hashFromRequest = checkProxyPath(hashCheckPath);
|
|
||||||
|
|
||||||
let proxyDestinationURL =
|
|
||||||
PROXY_RELAY_URL +
|
|
||||||
(req.url.indexOf("?hash=") > -1
|
|
||||||
? req.url.split("?hash=")[0]
|
|
||||||
: req.url.split("&hash=")[0]
|
|
||||||
).split("/api/proxy/")[1] +
|
|
||||||
(req.url.indexOf("?hash=") > -1
|
|
||||||
? "?hash=" + req.url.split("?hash=")[1]
|
|
||||||
: "&hash=" + req.url.split("&hash=")[1]);
|
|
||||||
|
|
||||||
var configNoData = {
|
|
||||||
method: req.method,
|
|
||||||
//url: PROXY_RELAY_URL + updateFormCollection + "(" + incidentId + ")",
|
|
||||||
url: proxyDestinationURL,
|
|
||||||
headers: {
|
|
||||||
"OData-MaxVersion": "4.0",
|
|
||||||
"OData-Version": "4.0",
|
|
||||||
"Accept": "application/json",
|
|
||||||
"Prefer":
|
|
||||||
'odata.include-annotations="*",return=representation,odata.maxpagesize=10',
|
|
||||||
"Authorization": "Bearer " + accessToken,
|
|
||||||
"Content-Type": "application/json",
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
var config = {
|
|
||||||
method: req.method,
|
|
||||||
url: proxyDestinationURL,
|
|
||||||
headers: {
|
|
||||||
"OData-MaxVersion": "4.0",
|
|
||||||
"OData-Version": "4.0",
|
|
||||||
"Accept": "application/json",
|
|
||||||
"Prefer": 'odata.include-annotations="*",return=representation',
|
|
||||||
"Authorization": "Bearer " + accessToken,
|
|
||||||
"Content-Type": "application/json",
|
|
||||||
},
|
|
||||||
data: data,
|
|
||||||
};
|
|
||||||
|
|
||||||
var configDocument = {
|
|
||||||
method: req.method,
|
|
||||||
url:
|
|
||||||
PROXY_RELAY_URL +
|
|
||||||
req.url.split("?hash=")[0].split("/api/proxy/")[1] +
|
|
||||||
"?hash=" +
|
|
||||||
req.url.split("?hash=")[1],
|
|
||||||
headers: {
|
|
||||||
"OData-MaxVersion": "4.0",
|
|
||||||
"OData-Version": "4.0",
|
|
||||||
"Accept": "application/json",
|
|
||||||
"Prefer": 'odata.include-annotations="*",return=representation',
|
|
||||||
"Authorization": "Bearer " + accessToken,
|
|
||||||
"Content-Type": "application/json",
|
|
||||||
},
|
|
||||||
responseType: "arraybuffer",
|
|
||||||
};
|
|
||||||
|
|
||||||
if (hashCheckValue == hashFromRequest) {
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
let hasDocument =
|
|
||||||
hashCheckPath.indexOf("/download") > 0 ? true : false;
|
|
||||||
|
|
||||||
axios(
|
|
||||||
req.method == "PATCH"
|
|
||||||
? config
|
|
||||||
: req.method == "GET"
|
|
||||||
? hasDocument
|
|
||||||
? configDocument
|
|
||||||
: configNoData
|
|
||||||
: config
|
|
||||||
)
|
|
||||||
.then((response) => {
|
|
||||||
res.statusCode = 200;
|
|
||||||
if (hasDocument) {
|
|
||||||
res.setHeader(
|
|
||||||
"Content-disposition",
|
|
||||||
"attachment; filename=" +
|
|
||||||
response.headers["content-disposition"].split(
|
|
||||||
"filename="
|
|
||||||
)[1]
|
|
||||||
);
|
|
||||||
res.end(response.data);
|
|
||||||
} else {
|
|
||||||
res.setHeader("Content-Type", "application/json");
|
|
||||||
// res.setHeader("Cache-Control", "max-age=1800000");
|
|
||||||
res.end(JSON.stringify(response.data));
|
|
||||||
}
|
|
||||||
resolve();
|
|
||||||
})
|
|
||||||
.catch((error) => {
|
|
||||||
console.log("proxy response error", error);
|
|
||||||
//res.json(error);
|
|
||||||
res.status(405).end();
|
|
||||||
return resolve();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
console.log(
|
|
||||||
"no matching hash",
|
|
||||||
hashCheckValue + " - " + hashFromRequest
|
|
||||||
);
|
|
||||||
res.status(405).end();
|
|
||||||
return resolve();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -136,14 +136,14 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
|||||||
tokenExpiryTimeAt.getSeconds() + token.expires_in
|
tokenExpiryTimeAt.getSeconds() + token.expires_in
|
||||||
);
|
);
|
||||||
|
|
||||||
console.log(
|
// console.log(
|
||||||
"token issued:",
|
// "token issued:",
|
||||||
tokenIssuedAt.toUTCString(),
|
// tokenIssuedAt.toUTCString(),
|
||||||
"\n",
|
// "\n",
|
||||||
"token expires:",
|
// "token expires:",
|
||||||
tokenExpiryTimeAt.toUTCString()
|
// tokenExpiryTimeAt.toUTCString()
|
||||||
);
|
// );
|
||||||
console.log(token);
|
// console.log(token);
|
||||||
|
|
||||||
token = token.access_token;
|
token = token.access_token;
|
||||||
|
|
||||||
|
|||||||
+2
-4
@@ -31,8 +31,6 @@ import {
|
|||||||
} from "../store/accountDetails/action";
|
} from "../store/accountDetails/action";
|
||||||
import { parseCookies, setCookie, destroyCookie } from "nookies";
|
import { parseCookies, setCookie, destroyCookie } from "nookies";
|
||||||
|
|
||||||
const WORDKEY = process.env.NEXT_PUBLIC_HASHKEY;
|
|
||||||
|
|
||||||
const Home = (props) => {
|
const Home = (props) => {
|
||||||
const {
|
const {
|
||||||
footerLinks,
|
footerLinks,
|
||||||
@@ -53,9 +51,9 @@ const Home = (props) => {
|
|||||||
let expDate = new Date(now);
|
let expDate = new Date(now);
|
||||||
expDate.setDate(now.getDate() + 1);
|
expDate.setDate(now.getDate() + 1);
|
||||||
|
|
||||||
console.log("hashed email str", loginEmailStr);
|
//console.log("hashed email str", loginEmailStr);
|
||||||
_.isEmpty(loggedInUserId) != false && !hasGGCode
|
_.isEmpty(loggedInUserId) != false && !hasGGCode
|
||||||
? console.log("no log in no ggcode")
|
? console.log("no ggcode")
|
||||||
: _.has(loggedInUserId, "value")
|
: _.has(loggedInUserId, "value")
|
||||||
? _.isEmpty(loggedInUserId.value)
|
? _.isEmpty(loggedInUserId.value)
|
||||||
? router.replace({
|
? router.replace({
|
||||||
|
|||||||
+15
-16
@@ -165,7 +165,7 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
|||||||
|
|
||||||
const { cookies } = req;
|
const { cookies } = req;
|
||||||
|
|
||||||
console.log("the cookoies", cookies);
|
// console.log("the cookoies", cookies);
|
||||||
|
|
||||||
let token = await getToken();
|
let token = await getToken();
|
||||||
token = token.access_token;
|
token = token.access_token;
|
||||||
@@ -174,13 +174,13 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
|||||||
|
|
||||||
let providerConfig = await getProviderConfig();
|
let providerConfig = await getProviderConfig();
|
||||||
|
|
||||||
console.log(
|
// console.log(
|
||||||
"logout endpoint: ",
|
// "logout endpoint: ",
|
||||||
providerConfig.end_session_endpoint,
|
// providerConfig.end_session_endpoint,
|
||||||
"\n",
|
// "\n",
|
||||||
"redirect:",
|
// "redirect:",
|
||||||
process.env.GG_REDIRECT_URI
|
// process.env.GG_REDIRECT_URI
|
||||||
);
|
//);
|
||||||
|
|
||||||
store.dispatch(getGovGatewayConfig(providerConfig));
|
store.dispatch(getGovGatewayConfig(providerConfig));
|
||||||
|
|
||||||
@@ -199,11 +199,11 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
//const cookiesMaker = nookies.get(ctx)
|
//const cookiesMaker = nookies.get(ctx)
|
||||||
console.log(
|
// console.log(
|
||||||
"acc details:",
|
// "acc details:",
|
||||||
accountDetails,
|
// accountDetails,
|
||||||
_.has(accountDetails, "errorCode") != false
|
// _.has(accountDetails, "errorCode") != false
|
||||||
);
|
// );
|
||||||
|
|
||||||
if (_.has(accountDetails, "errorCode") != false) {
|
if (_.has(accountDetails, "errorCode") != false) {
|
||||||
return {
|
return {
|
||||||
@@ -222,7 +222,7 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
|||||||
await getDetails(token, myCases, "myCases"),
|
await getDetails(token, myCases, "myCases"),
|
||||||
await getDetails(token, myRepresentations, "myRepresentations"),
|
await getDetails(token, myRepresentations, "myRepresentations"),
|
||||||
await getDetails(token, watchedCases, "myWatchedCases"),
|
await getDetails(token, watchedCases, "myWatchedCases"),
|
||||||
// await getDetails(awaitingSubmission),
|
//await getDetails(awaitingSubmission),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
store.dispatch(setAccountDetails(accountDetails));
|
store.dispatch(setAccountDetails(accountDetails));
|
||||||
@@ -244,7 +244,7 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
|||||||
);
|
);
|
||||||
|
|
||||||
const getDetails = (token, resultsObj, detailsType) => {
|
const getDetails = (token, resultsObj, detailsType) => {
|
||||||
console.log(resultsObj);
|
console.log(detailsType);
|
||||||
let detailsArr = [];
|
let detailsArr = [];
|
||||||
resultsObj = resultsObj.value;
|
resultsObj = resultsObj.value;
|
||||||
const detailsObj = resultsObj.map((searchDetail, index) => {
|
const detailsObj = resultsObj.map((searchDetail, index) => {
|
||||||
@@ -271,7 +271,6 @@ const getDetails = (token, resultsObj, detailsType) => {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
//console.log(detailsArr);
|
|
||||||
return Promise.all(detailsArr);
|
return Promise.all(detailsArr);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -131,7 +131,7 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
|||||||
? true
|
? true
|
||||||
: false;
|
: false;
|
||||||
|
|
||||||
console.log("is linked:", isLinked);
|
//console.log("is linked:", isLinked);
|
||||||
let token = await getToken();
|
let token = await getToken();
|
||||||
|
|
||||||
var tokenIssuedAt = new Date();
|
var tokenIssuedAt = new Date();
|
||||||
@@ -140,14 +140,14 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
|||||||
tokenExpiryTimeAt.getSeconds() + token.expires_in
|
tokenExpiryTimeAt.getSeconds() + token.expires_in
|
||||||
);
|
);
|
||||||
|
|
||||||
console.log(
|
// console.log(
|
||||||
"token issued:",
|
// "token issued:",
|
||||||
tokenIssuedAt.toUTCString(),
|
// tokenIssuedAt.toUTCString(),
|
||||||
"\n",
|
// "\n",
|
||||||
"token expires:",
|
// "token expires:",
|
||||||
tokenExpiryTimeAt.toUTCString()
|
// tokenExpiryTimeAt.toUTCString()
|
||||||
);
|
// );
|
||||||
console.log(token);
|
// //console.log(token);
|
||||||
|
|
||||||
token = token.access_token;
|
token = token.access_token;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user