Removed proxy and added api calls, has gov gateway auth
This commit is contained in:
+4
-5
@@ -1,11 +1,10 @@
|
||||
// 404.js
|
||||
import Link from "next/link";
|
||||
import Head from "next/head";
|
||||
import Header from "../components/header";
|
||||
import Banner from "../components/banner";
|
||||
import CookieBanner from "../components/cookieBanner";
|
||||
import useTranslation from "next-translate/useTranslation";
|
||||
import Head from "next/head";
|
||||
import Link from "next/link";
|
||||
import CookieBanner from "../components/cookieBanner";
|
||||
import Footer from "../components/footer";
|
||||
import Header from "../components/header";
|
||||
|
||||
const FourOhFour = (props) => {
|
||||
let { t, lang } = useTranslation();
|
||||
|
||||
+30
-5
@@ -2,6 +2,7 @@ import Document, { Html, Head, Main, NextScript } from "next/document";
|
||||
import SkipLink from "../components/skiplink";
|
||||
import { Tracking, TrackingNoScript } from "../components/tracking";
|
||||
import basicAuthMiddleware from "nextjs-basic-auth-middleware";
|
||||
import { nanoid } from "nanoid";
|
||||
|
||||
class MyDocument extends Document {
|
||||
static async getInitialProps(ctx) {
|
||||
@@ -13,7 +14,7 @@ class MyDocument extends Document {
|
||||
let hasBasicAuth =
|
||||
typeof process.env.BASIC_AUTH_CREDENTIALS != "undefined";
|
||||
|
||||
console.log(hasBasicAuth);
|
||||
console.log("hasbasicAuth:", hasBasicAuth);
|
||||
|
||||
if (ctx.req && ctx.res) {
|
||||
hasBasicAuth &&
|
||||
@@ -38,23 +39,47 @@ class MyDocument extends Document {
|
||||
render() {
|
||||
const googleTagManagerID = process.env.GOOGLE_TAG_MANAGER || null;
|
||||
const { useGATracking } = this.props;
|
||||
|
||||
const generatedNonce = nanoid();
|
||||
|
||||
let csp = ``;
|
||||
csp += `base-uri 'self';`;
|
||||
csp += `form-action 'self';`;
|
||||
csp += `object-src 'self' data:;`;
|
||||
csp += `script-src 'self' https://www.googletagmanager.com 'nonce-${generatedNonce}' ${
|
||||
process.env.NODE_ENV != "production" ? " 'unsafe-eval';" : " ;"
|
||||
}`;
|
||||
csp += `img-src 'self' https://www.googletagmanager.com https://gov.wales https://www.google-analytics.com 'nonce-${generatedNonce}' data:;`;
|
||||
csp += `style-src 'self' https://fonts.googleapis.com 'unsafe-inline' data:;`;
|
||||
|
||||
return (
|
||||
<Html lang="en">
|
||||
<Head>
|
||||
<meta httpEquiv="Content-Security-Policy" content={csp} />
|
||||
{useGATracking && (
|
||||
<Tracking googleTagManagerID={googleTagManagerID} />
|
||||
<Tracking
|
||||
googleTagManagerID={googleTagManagerID}
|
||||
nonce={generatedNonce}
|
||||
/>
|
||||
)}
|
||||
</Head>
|
||||
<body className="js-enabled">
|
||||
{useGATracking && (
|
||||
<TrackingNoScript
|
||||
nonce={generatedNonce}
|
||||
googleTagManagerID={googleTagManagerID}
|
||||
/>
|
||||
)}
|
||||
{!process.browser && (
|
||||
<script>
|
||||
window.switchDomain = `{process.env.I18N_DOMAIN}`
|
||||
</script>
|
||||
<>
|
||||
<script nonce={generatedNonce}>
|
||||
window.switchDomain = `{process.env.I18N_DOMAIN}
|
||||
`
|
||||
</script>
|
||||
<script nonce={generatedNonce}>
|
||||
window.apiRoot = `{process.env.API_ROOT}`
|
||||
</script>
|
||||
</>
|
||||
)}
|
||||
<SkipLink />
|
||||
<Main />
|
||||
|
||||
+4
-5
@@ -1,10 +1,9 @@
|
||||
import Link from "next/link";
|
||||
import Head from "next/head";
|
||||
import Header from "../components/header";
|
||||
import Banner from "../components/banner";
|
||||
import CookieBanner from "../components/cookieBanner";
|
||||
import useTranslation from "next-translate/useTranslation";
|
||||
import Head from "next/head";
|
||||
import Link from "next/link";
|
||||
import CookieBanner from "../components/cookieBanner";
|
||||
import Footer from "../components/footer";
|
||||
import Header from "../components/header";
|
||||
|
||||
function Error({ statusCode }, props) {
|
||||
let { t, lang } = useTranslation();
|
||||
|
||||
+7
-16
@@ -1,26 +1,17 @@
|
||||
import _ from "lodash";
|
||||
import { useState, useEffect, useRef } from "react";
|
||||
import useTranslation from "next-translate/useTranslation";
|
||||
import Head from "next/head";
|
||||
import { useRouter } from "next/router";
|
||||
import AccessibilityStatement from "../components/accessibility";
|
||||
import Breadcrumbs from "../components/breadcrumbs";
|
||||
import CookieBanner from "../components/cookieBanner";
|
||||
import Footer from "../components/footer";
|
||||
import Header from "../components/header";
|
||||
import ServiceBanner from "../components/servicebanner";
|
||||
import CookieBanner from "../components/cookieBanner";
|
||||
import Breadcrumbs from "../components/breadcrumbs";
|
||||
import Main from "../components/main";
|
||||
import Footer from "../components/footer";
|
||||
import Errorpage from "../components/errorpage";
|
||||
import styles from "../styles/Home.module.css";
|
||||
import { useSelector, shallowEqual, connect } from "react-redux";
|
||||
import { wrapper } from "../store/store";
|
||||
import { useRouter } from "next/router";
|
||||
import useTranslation from "next-translate/useTranslation";
|
||||
import { getIncidents } from "../actions";
|
||||
import { parseCookies } from "nookies";
|
||||
import AccessibilityStatement from "../components/accessibility";
|
||||
|
||||
const Accessibility = (props) => {
|
||||
const { footerLinks, pages, showLogin } = props;
|
||||
let { t, lang } = useTranslation();
|
||||
|
||||
ß;
|
||||
const router = useRouter();
|
||||
const { locale } = router;
|
||||
|
||||
|
||||
+30
-12
@@ -17,9 +17,10 @@ import jsonpath from "jsonpath";
|
||||
import { reduxForm, formValueSelector } from "redux-form";
|
||||
|
||||
import RegisterForm from "../../components/account/registerform";
|
||||
import { dehashString, hashAPIPath } from "../../actions";
|
||||
|
||||
const Home = (props) => {
|
||||
const { footerLinks, formData } = props;
|
||||
const { footerLinks, formData, loggedInUserEmail } = props;
|
||||
let { t, lang } = useTranslation();
|
||||
|
||||
const router = useRouter();
|
||||
@@ -97,6 +98,9 @@ const Home = (props) => {
|
||||
setAccountCreatedComplete={
|
||||
setAccountCreatedComplete
|
||||
}
|
||||
loggedInUserEmail={
|
||||
loggedInUserEmail
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
{registerFormComplete != true ||
|
||||
@@ -151,17 +155,31 @@ const Home = (props) => {
|
||||
);
|
||||
};
|
||||
|
||||
// export const getServerSideProps = wrapper.getServerSideProps(
|
||||
// (store) =>
|
||||
// async ({ query, req, res }) => {
|
||||
// const appealTypeData = await getAppealsTypes();
|
||||
// const lpaData = await getLPA();
|
||||
// console.log("appeal types", appealTypeData);
|
||||
// console.log("lpa typeswwwww", lpaData);
|
||||
// store.dispatch(setAppealType(appealTypeData));
|
||||
// store.dispatch(setLPA(lpaData));
|
||||
// }
|
||||
// );
|
||||
export const getServerSideProps = wrapper.getServerSideProps(
|
||||
(store) =>
|
||||
async ({ query, req, res }) => {
|
||||
// const appealTypeData = await getAppealsTypes();
|
||||
// const lpaData = await getLPA();
|
||||
// console.log("appeal types", appealTypeData);
|
||||
// console.log("lpa typeswwwww", lpaData);
|
||||
// store.dispatch(setAppealType(appealTypeData));
|
||||
// store.dispatch(setLPA(lpaData));
|
||||
|
||||
let hasRegistrationEmail = typeof query.id != "undefined";
|
||||
let loginEmailStr = "";
|
||||
|
||||
if (hasRegistrationEmail == true) {
|
||||
loginEmailStr = dehashString(query.id);
|
||||
|
||||
console.log(loginEmailStr);
|
||||
}
|
||||
return {
|
||||
props: {
|
||||
loggedInUserEmail: loginEmailStr,
|
||||
},
|
||||
};
|
||||
}
|
||||
);
|
||||
|
||||
const mapStateToProps = (state) => {
|
||||
return {
|
||||
|
||||
+13
-50
@@ -1,36 +1,18 @@
|
||||
import _ from "lodash";
|
||||
import { useState } from "react";
|
||||
import Head from "next/head";
|
||||
import Header from "../components/header";
|
||||
import Banner from "../components/banner";
|
||||
import CookieBanner from "../components/cookieBanner";
|
||||
import Breadcrumbs from "../components/breadcrumbs";
|
||||
import Search from "../components/search";
|
||||
import Footer from "../components/footer";
|
||||
import Errorpage from "../components/errorpage";
|
||||
import styles from "../styles/Home.module.css";
|
||||
import { useSelector, shallowEqual, connect } from "react-redux";
|
||||
import { wrapper } from "../store/store";
|
||||
|
||||
import { useRouter } from "next/router";
|
||||
import useTranslation from "next-translate/useTranslation";
|
||||
import Head from "next/head";
|
||||
import { useRouter } from "next/router";
|
||||
import { connect } from "react-redux";
|
||||
import { getAppealsTypes, getLPA } from "../actions";
|
||||
import Breadcrumbs from "../components/breadcrumbs";
|
||||
import CookieBanner from "../components/cookieBanner";
|
||||
import CRMError from "../components/crmError";
|
||||
|
||||
import {
|
||||
setAppealType,
|
||||
setAppealTypeTitle,
|
||||
setAppealTypeID,
|
||||
setAppealLPA,
|
||||
getAppealTypeObj,
|
||||
} from "../store/appealType/action";
|
||||
import {
|
||||
getAppealsTypes,
|
||||
getLPA,
|
||||
updateCase,
|
||||
createCase,
|
||||
getToken,
|
||||
} from "../actions";
|
||||
import Footer from "../components/footer";
|
||||
import Header from "../components/header";
|
||||
import Search from "../components/search";
|
||||
import { setAppealType } from "../store/appealType/action";
|
||||
import { setLPA } from "../store/lpa/action";
|
||||
import { wrapper } from "../store/store";
|
||||
|
||||
const Home = (props) => {
|
||||
const { footerLinks, pages } = props;
|
||||
@@ -40,7 +22,6 @@ const Home = (props) => {
|
||||
const { locale } = router;
|
||||
const { appealtypes } = router.query;
|
||||
|
||||
//console.log(props, props.LPAData);
|
||||
var hasError =
|
||||
_.has(props.LPAData.LPAData, "errorCode") ||
|
||||
_.has(props.appealType.appealType, "errorCode")
|
||||
@@ -139,27 +120,9 @@ const Home = (props) => {
|
||||
export const getServerSideProps = wrapper.getServerSideProps(
|
||||
(store) =>
|
||||
async ({ query, req, res }) => {
|
||||
let token = await getToken();
|
||||
|
||||
var tokenIssuedAt = new Date();
|
||||
var tokenExpiryTimeAt = new Date();
|
||||
tokenExpiryTimeAt.setSeconds(
|
||||
tokenExpiryTimeAt.getSeconds() + token.expires_in
|
||||
);
|
||||
|
||||
console.log(
|
||||
"token issued:",
|
||||
tokenIssuedAt.toUTCString(),
|
||||
"\n",
|
||||
"token expires:",
|
||||
tokenExpiryTimeAt.toUTCString()
|
||||
);
|
||||
console.log(token);
|
||||
token = token.access_token;
|
||||
|
||||
const [appealTypeData, lpaData] = await Promise.all([
|
||||
await getAppealsTypes(token),
|
||||
await getLPA(token),
|
||||
await getAppealsTypes(),
|
||||
await getLPA(),
|
||||
]);
|
||||
|
||||
store.dispatch(setAppealType(appealTypeData));
|
||||
|
||||
@@ -1,28 +1,20 @@
|
||||
import _ from "lodash";
|
||||
import Head from "next/head";
|
||||
import Header from "../components/header";
|
||||
import Banner from "../components/banner";
|
||||
import CookieBanner from "../components/cookieBanner";
|
||||
import Breadcrumbs from "../components/breadcrumbs";
|
||||
import SearchResults from "../components/searchresults";
|
||||
import Footer from "../components/footer";
|
||||
import Errorpage from "../components/errorpage";
|
||||
import styles from "../styles/Home.module.css";
|
||||
import { useSelector, shallowEqual, connect } from "react-redux";
|
||||
import { wrapper } from "../store/store";
|
||||
|
||||
import { useRouter } from "next/router";
|
||||
import useTranslation from "next-translate/useTranslation";
|
||||
import jsonpath from "jsonpath";
|
||||
import data from "../data/collections.json";
|
||||
import Head from "next/head";
|
||||
import { useRouter } from "next/router";
|
||||
import { connect } from "react-redux";
|
||||
import { getAdvancedSearch } from "../actions";
|
||||
import Breadcrumbs from "../components/breadcrumbs";
|
||||
import CookieBanner from "../components/cookieBanner";
|
||||
import Footer from "../components/footer";
|
||||
import Header from "../components/header";
|
||||
import SearchResults from "../components/searchresults";
|
||||
import { getSearchDetails } from "../components/utils";
|
||||
import { setSearch, getSearchObj } from "../store/search/action";
|
||||
import { setSearch } from "../store/search/action";
|
||||
import {
|
||||
setSearchResults,
|
||||
setSearchDetails,
|
||||
getSearchResultsObj,
|
||||
setSearchResults,
|
||||
} from "../store/searchOutput/action";
|
||||
import { getAdvancedSearch, getBasicSearchDetails, getToken } from "../actions";
|
||||
import { wrapper } from "../store/store";
|
||||
|
||||
const Home = (props) => {
|
||||
const { footerLinks, pages } = props;
|
||||
@@ -123,14 +115,8 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
||||
console.log("query-", query);
|
||||
//console.log("search array:", Object.entries(query));
|
||||
|
||||
let token = await getToken();
|
||||
token = token.access_token;
|
||||
|
||||
const searchResultsObj = await getAdvancedSearch(token, query);
|
||||
const searchDetailsObj = await getSearchDetails(
|
||||
token,
|
||||
searchResultsObj
|
||||
);
|
||||
const searchResultsObj = await getAdvancedSearch(query);
|
||||
const searchDetailsObj = await getSearchDetails(searchResultsObj);
|
||||
|
||||
store.dispatch(setSearchResults(searchResultsObj));
|
||||
store.dispatch(setSearchDetails(searchDetailsObj));
|
||||
|
||||
@@ -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,49 @@
|
||||
import axios from "axios";
|
||||
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 }) => {
|
||||
res.status(200).json(data);
|
||||
})
|
||||
.catch(({ err }) => {
|
||||
res.status(400).json(err);
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
import axios from "axios";
|
||||
import CryptoJS from "crypto-js";
|
||||
import _ from "lodash";
|
||||
import { getToken, azureHeadersPaged } from "../../../actions";
|
||||
|
||||
const WORDKEY = process.env.HASHKEY;
|
||||
|
||||
const WEBAPI_URL =
|
||||
process.env.RELAY_ROOT ||
|
||||
"https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/";
|
||||
|
||||
const hashAPIPath = (queryPath) => {
|
||||
var hashlink = CryptoJS.HmacSHA256(
|
||||
queryPath,
|
||||
CryptoJS.enc.Hex.parse(WORDKEY)
|
||||
);
|
||||
hashlink = hashlink.toString(CryptoJS.enc.Hex);
|
||||
|
||||
//return "&hash=" + hashlink;
|
||||
|
||||
return (queryPath.indexOf("?") > -1 ? "&hash=" : "?hash=") + hashlink;
|
||||
};
|
||||
|
||||
export default async function ApiProxy(req, res) {
|
||||
var contactid = req.query.contactid;
|
||||
var appealTypeId = req.query.appealTypeId;
|
||||
var lpaID = req.query.lpaID;
|
||||
var queryUrl = "incidents";
|
||||
var token = await getToken();
|
||||
|
||||
var data = JSON.stringify({
|
||||
"title": "insertion test case",
|
||||
"caseorigincode": 3,
|
||||
"customerid_contact@odata.bind": "/contacts(" + contactid + ")",
|
||||
"pinswg_appealcasetype": appealTypeId,
|
||||
"pinswg_AssociatedLPA@odata.bind": "/accounts(" + lpaID + ")",
|
||||
});
|
||||
|
||||
var config = {
|
||||
method: "post",
|
||||
url: WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
||||
headers: {
|
||||
"OData-MaxVersion": "4.0",
|
||||
"OData-Version": "4.0",
|
||||
"Accept": "application/json",
|
||||
"Prefer": 'odata.include-annotations="*",return=representation',
|
||||
"Authorization": "Bearer " + token.access_token,
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
data: data,
|
||||
};
|
||||
|
||||
var apiResponse = _.isEmpty(req.query)
|
||||
? res.status(400).json()
|
||||
: axios(config)
|
||||
.then(({ data }) => {
|
||||
console.log(data);
|
||||
res.status(200).json(data);
|
||||
})
|
||||
.catch(({ err }) => {
|
||||
res.status(400).json(err);
|
||||
});
|
||||
|
||||
return apiResponse;
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
import axios from "axios";
|
||||
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";
|
||||
|
||||
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="*"',
|
||||
"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 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 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 watched case - " + watchedCaseID);
|
||||
res.status(200).json(data);
|
||||
})
|
||||
.catch(({ err }) => {
|
||||
res.status(400).json(err);
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
import axios from "axios";
|
||||
import CryptoJS from "crypto-js";
|
||||
import _ from "lodash";
|
||||
import { getToken, azureHeadersPaged } from "../../../actions";
|
||||
|
||||
const WORDKEY = process.env.HASHKEY;
|
||||
|
||||
const WEBAPI_URL =
|
||||
process.env.RELAY_ROOT ||
|
||||
"https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/";
|
||||
|
||||
const hashAPIPath = (queryPath) => {
|
||||
var hashlink = CryptoJS.HmacSHA256(
|
||||
queryPath,
|
||||
CryptoJS.enc.Hex.parse(WORDKEY)
|
||||
);
|
||||
hashlink = hashlink.toString(CryptoJS.enc.Hex);
|
||||
|
||||
//return "&hash=" + hashlink;
|
||||
|
||||
return (queryPath.indexOf("?") > -1 ? "&hash=" : "?hash=") + hashlink;
|
||||
};
|
||||
|
||||
export default async function ApiProxy(req, res) {
|
||||
var searchString = req.query.searchstring;
|
||||
var token = await getToken();
|
||||
|
||||
searchString = _.isEmpty(searchString)
|
||||
? searchString
|
||||
: JSON.parse(decodeURI(searchString));
|
||||
|
||||
var queryString = "";
|
||||
|
||||
queryString +=
|
||||
_.has(searchString, "q") && searchString.q != null
|
||||
? "(contains(title, '" +
|
||||
searchString.q +
|
||||
"') or contains(ticketnumber,'" +
|
||||
searchString.q +
|
||||
"'))"
|
||||
: "";
|
||||
|
||||
queryString +=
|
||||
_.has(searchString, "lpa") && searchString.lpa != null
|
||||
? (typeof searchString.q == "undefined" ? "" : " and ") +
|
||||
"_pinswg_associatedlpa_value eq " +
|
||||
searchString.lpa
|
||||
: "";
|
||||
queryString +=
|
||||
_.has(searchString, "apt") && 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";
|
||||
|
||||
var apiResponse = _.isEmpty(searchString)
|
||||
? res.status(400).json()
|
||||
: axios
|
||||
.get(
|
||||
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
||||
azureHeadersPaged(token.access_token)
|
||||
)
|
||||
.then(({ data }) => {
|
||||
var dataStr;
|
||||
_.has(data, "@odata.nextLink") == true &&
|
||||
((dataStr = JSON.stringify(data["@odata.nextLink"])),
|
||||
(data["@odata.nextLink"] = dataStr.split("/v8.2/")[1]));
|
||||
res.status(200).json(data);
|
||||
})
|
||||
.catch(({ err }) => {
|
||||
res.status(400).json(err);
|
||||
});
|
||||
|
||||
return apiResponse;
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
import axios from "axios";
|
||||
import CryptoJS from "crypto-js";
|
||||
import _ from "lodash";
|
||||
import { getToken, azureHeadersPaged } from "../../../actions";
|
||||
|
||||
const WORDKEY = process.env.HASHKEY;
|
||||
|
||||
const WEBAPI_URL =
|
||||
process.env.RELAY_ROOT ||
|
||||
"https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/";
|
||||
|
||||
const hashAPIPath = (queryPath) => {
|
||||
var hashlink = CryptoJS.HmacSHA256(
|
||||
queryPath,
|
||||
CryptoJS.enc.Hex.parse(WORDKEY)
|
||||
);
|
||||
hashlink = hashlink.toString(CryptoJS.enc.Hex);
|
||||
|
||||
//return "&hash=" + hashlink;
|
||||
|
||||
return (queryPath.indexOf("?") > -1 ? "&hash=" : "?hash=") + hashlink;
|
||||
};
|
||||
|
||||
export default async function ApiProxy(req, res) {
|
||||
var searchString = req.query.searchstring;
|
||||
var pageNumber = req.query.pageNumber;
|
||||
var token = await getToken();
|
||||
|
||||
searchString = _.isEmpty(searchString)
|
||||
? searchString
|
||||
: JSON.parse(decodeURI(searchString));
|
||||
|
||||
var queryString = "";
|
||||
|
||||
queryString +=
|
||||
_.has(searchString, "q") && searchString.q != null
|
||||
? "(contains(title, '" +
|
||||
searchString.q +
|
||||
"') or contains(ticketnumber,'" +
|
||||
searchString.q +
|
||||
"'))"
|
||||
: "";
|
||||
|
||||
queryString +=
|
||||
_.has(searchString, "lpa") && searchString.lpa != null
|
||||
? (typeof searchString.q == "undefined" ? "" : " and ") +
|
||||
"_pinswg_associatedlpa_value eq " +
|
||||
searchString.lpa
|
||||
: "";
|
||||
queryString +=
|
||||
_.has(searchString, "apt") && 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 + '" />')
|
||||
: "");
|
||||
|
||||
var apiResponse = _.isEmpty(searchString)
|
||||
? res.status(400).json()
|
||||
: axios
|
||||
.get(
|
||||
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
||||
azureHeadersPaged(token.access_token)
|
||||
)
|
||||
.then(({ data }) => {
|
||||
var dataStr;
|
||||
_.has(data, "@odata.nextLink") == true &&
|
||||
((dataStr = JSON.stringify(data["@odata.nextLink"])),
|
||||
(data["@odata.nextLink"] = dataStr.split("/v8.2/")[1]));
|
||||
res.status(200).json(data);
|
||||
})
|
||||
.catch(({ err }) => {
|
||||
res.status(400).json(err);
|
||||
});
|
||||
|
||||
return apiResponse;
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
import axios from "axios";
|
||||
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 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),
|
||||
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 CryptoJS from "crypto-js";
|
||||
import { getToken, azureHeadersPaged, azureHeaders } from "../../../actions";
|
||||
/**
|
||||
* @swagger
|
||||
* /api/endpoint/getappealtypes_api:
|
||||
* get:
|
||||
* description: Returns appeal types
|
||||
* responses:
|
||||
* 200:
|
||||
* description:
|
||||
*
|
||||
*/
|
||||
|
||||
const WORDKEY = process.env.HASHKEY;
|
||||
|
||||
const WEBAPI_URL =
|
||||
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 =
|
||||
"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.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 CryptoJS from "crypto-js";
|
||||
import _ from "lodash";
|
||||
import { getToken, azureHeaders, 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 =
|
||||
"incidents?$select=numberofchildincidents,_accountid_value,_customerid_value,_pinswg_associatedlpa_value,_ownerid_value,pinswg_appealcasetype,statuscode,ticketnumber,title, _primarycontactid_value&$expand=primarycontactid($select=fullname)&$filter=pinswg_appealcasetype eq 846040011 and pinswg_publishtoweb eq true&$orderby=createdon desc&$count=true";
|
||||
|
||||
return axios
|
||||
.get(
|
||||
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
||||
azureHeadersPaged(token.access_token)
|
||||
)
|
||||
.then(({ data }) => {
|
||||
var dataStr;
|
||||
_.has(data, "@odata.nextLink") == true &&
|
||||
((dataStr = JSON.stringify(data["@odata.nextLink"])),
|
||||
(data["@odata.nextLink"] = dataStr.split("/v8.2/")[1]));
|
||||
res.status(200).json(data);
|
||||
})
|
||||
.catch(({ err }) => {
|
||||
res.status(400).json(err);
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
import axios from "axios";
|
||||
import CryptoJS from "crypto-js";
|
||||
import _ from "lodash";
|
||||
import { getToken, azureHeadersPaged } from "../../../actions";
|
||||
import { getSelectQuery } from "../../../actions/selectQueryTypes";
|
||||
|
||||
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";
|
||||
|
||||
queryUrl = queryUrl + getSelectQuery("pinswg_dnses");
|
||||
|
||||
var apiResponse = _.isEmpty(req.query)
|
||||
? res.status(400).json()
|
||||
: typeof caseReference != "undefined" && caseReference.length > 0
|
||||
? axios
|
||||
.get(
|
||||
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
||||
azureHeaders(token.access_token)
|
||||
)
|
||||
.then(({ data }) => {
|
||||
res.status(200).json(data);
|
||||
})
|
||||
.catch(({ err }) => {
|
||||
res.status(400).json(err);
|
||||
})
|
||||
: res.status(400).json();
|
||||
|
||||
return apiResponse;
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
import axios from "axios";
|
||||
import CryptoJS from "crypto-js";
|
||||
import _ from "lodash";
|
||||
import { getToken, azureHeadersPaged } from "../../../actions";
|
||||
import { getSelectQuery } from "../../../actions/selectQueryTypes";
|
||||
|
||||
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";
|
||||
|
||||
queryUrl = queryUrl + getSelectQuery("pinswg_dnses");
|
||||
|
||||
var apiResponse = _.isEmpty(req.query)
|
||||
? res.status(400).json()
|
||||
: typeof caseReference != "undefined" && caseReference.length > 0
|
||||
? axios
|
||||
.get(
|
||||
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
||||
azureHeadersPaged(token.access_token)
|
||||
)
|
||||
.then(({ data }) => {
|
||||
var dataStr;
|
||||
_.has(data, "@odata.nextLink") == true &&
|
||||
((dataStr = JSON.stringify(data["@odata.nextLink"])),
|
||||
(data["@odata.nextLink"] = dataStr.split("/v8.2/")[1]));
|
||||
return res.status(200).json(data);
|
||||
})
|
||||
.catch(({ err }) => {
|
||||
res.status(400).json(err);
|
||||
})
|
||||
: res.status(400).json();
|
||||
|
||||
return apiResponse;
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
import axios from "axios";
|
||||
import CryptoJS from "crypto-js";
|
||||
import _ from "lodash";
|
||||
import { getToken, azureHeadersPaged } from "../../../actions";
|
||||
|
||||
const WORDKEY = process.env.HASHKEY;
|
||||
|
||||
const WEBAPI_URL =
|
||||
process.env.RELAY_ROOT ||
|
||||
"https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/";
|
||||
|
||||
const hashAPIPath = (queryPath) => {
|
||||
var hashlink = CryptoJS.HmacSHA256(
|
||||
queryPath,
|
||||
CryptoJS.enc.Hex.parse(WORDKEY)
|
||||
);
|
||||
hashlink = hashlink.toString(CryptoJS.enc.Hex);
|
||||
|
||||
//return "&hash=" + hashlink;
|
||||
//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 + '" />'
|
||||
: "");
|
||||
|
||||
return axios
|
||||
.get(
|
||||
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
||||
azureHeadersPaged(token.access_token)
|
||||
)
|
||||
.then(({ data }) => {
|
||||
var dataStr;
|
||||
_.has(data, "@odata.nextLink") == true &&
|
||||
((dataStr = JSON.stringify(data["@odata.nextLink"])),
|
||||
(data["@odata.nextLink"] = dataStr.split("/v8.2/")[1]));
|
||||
return res.status(200).json(data);
|
||||
})
|
||||
.catch(({ err }) => {
|
||||
res.status(400).json(err);
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
import axios from "axios";
|
||||
import CryptoJS from "crypto-js";
|
||||
import _ from "lodash";
|
||||
import { getToken, azureHeadersPaged } from "../../../actions";
|
||||
|
||||
const WORDKEY = process.env.HASHKEY;
|
||||
|
||||
const WEBAPI_URL =
|
||||
process.env.RELAY_ROOT ||
|
||||
"https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/";
|
||||
|
||||
const hashAPIPath = (queryPath) => {
|
||||
var hashlink = CryptoJS.HmacSHA256(
|
||||
queryPath,
|
||||
CryptoJS.enc.Hex.parse(WORDKEY)
|
||||
);
|
||||
hashlink = hashlink.toString(CryptoJS.enc.Hex);
|
||||
|
||||
//return "&hash=" + hashlink;
|
||||
|
||||
return (queryPath.indexOf("?") > -1 ? "&hash=" : "?hash=") + hashlink;
|
||||
};
|
||||
|
||||
export default async function ApiProxy(req, res) {
|
||||
var searchString = req.query.searchString;
|
||||
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";
|
||||
|
||||
var apiResponse = _.isEmpty(req.query)
|
||||
? res.status(400).json()
|
||||
: searchString.length > 0
|
||||
? axios
|
||||
.get(
|
||||
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
||||
azureHeadersPaged(token.access_token)
|
||||
)
|
||||
.then(({ data }) => {
|
||||
var dataStr;
|
||||
_.has(data, "@odata.nextLink") == true &&
|
||||
((dataStr = JSON.stringify(data["@odata.nextLink"])),
|
||||
(data["@odata.nextLink"] = dataStr.split("/v8.2/")[1]));
|
||||
res.status(200).json(data);
|
||||
})
|
||||
.catch(({ err }) => {
|
||||
res.status(400).json(err);
|
||||
})
|
||||
: res.status(400).json();
|
||||
|
||||
return apiResponse;
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
import axios from "axios";
|
||||
import CryptoJS from "crypto-js";
|
||||
import { getToken, azureHeaders } from "../../../actions";
|
||||
import { getSelectQuery } from "../../../actions/selectQueryTypes";
|
||||
|
||||
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";
|
||||
|
||||
queryUrl = queryUrl + getSelectQuery(appealTypeName);
|
||||
|
||||
console.log("query: ", queryUrl, "<<<<end query");
|
||||
|
||||
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,58 @@
|
||||
import axios from "axios";
|
||||
import CryptoJS from "crypto-js";
|
||||
import _ from "lodash";
|
||||
import { getToken, azureHeadersPaged } from "../../../actions";
|
||||
import { getSelectQuery } from "../../../actions/selectQueryTypes";
|
||||
|
||||
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";
|
||||
|
||||
queryUrl = queryUrl + getSelectQuery(appealTypeName);
|
||||
|
||||
console.log("query: ", queryUrl, "<<<<end query");
|
||||
|
||||
return axios
|
||||
.get(
|
||||
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
||||
azureHeadersPaged(token.access_token)
|
||||
)
|
||||
.then(({ data }) => {
|
||||
var dataStr;
|
||||
_.has(data, "@odata.nextLink") == true &&
|
||||
((dataStr = JSON.stringify(data["@odata.nextLink"])),
|
||||
(data["@odata.nextLink"] = dataStr.split("/v8.2/")[1]));
|
||||
return res.status(200).json(data);
|
||||
})
|
||||
.catch(({ err }) => {
|
||||
res.status(400).json(err);
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
import axios from "axios";
|
||||
import CryptoJS from "crypto-js";
|
||||
import _ from "lodash";
|
||||
import { getToken, azureHeadersPaged } from "../../../actions";
|
||||
|
||||
const WORDKEY = process.env.HASHKEY;
|
||||
|
||||
const WEBAPI_URL =
|
||||
process.env.RELAY_ROOT ||
|
||||
"https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/";
|
||||
|
||||
const hashAPIPath = (queryPath) => {
|
||||
var hashlink = CryptoJS.HmacSHA256(
|
||||
queryPath,
|
||||
CryptoJS.enc.Hex.parse(WORDKEY)
|
||||
);
|
||||
hashlink = hashlink.toString(CryptoJS.enc.Hex);
|
||||
|
||||
return (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 + '" />'
|
||||
: "");
|
||||
|
||||
var apiResponse =
|
||||
searchString.length > 0
|
||||
? axios
|
||||
.get(
|
||||
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
||||
azureHeadersPaged(token.access_token)
|
||||
)
|
||||
.then(({ data }) => {
|
||||
var dataStr;
|
||||
_.has(data, "@odata.nextLink") == true &&
|
||||
((dataStr = JSON.stringify(data["@odata.nextLink"])),
|
||||
(data["@odata.nextLink"] =
|
||||
dataStr.split("/v8.2/")[1]));
|
||||
res.status(200).json(data);
|
||||
})
|
||||
.catch(({ err }) => {
|
||||
res.status(400).json(err);
|
||||
})
|
||||
: res.status(400).json();
|
||||
|
||||
return apiResponse;
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
import axios from "axios";
|
||||
import CryptoJS from "crypto-js";
|
||||
import _ from "lodash";
|
||||
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";
|
||||
|
||||
var apiResponse = _.isEmpty(req.query)
|
||||
? res.status(400).json()
|
||||
: typeof emailAddress != "undefined" && emailAddress.length > 0
|
||||
? axios
|
||||
.get(
|
||||
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
||||
azureHeaders(token.access_token)
|
||||
)
|
||||
.then(({ data }) => {
|
||||
res.status(200).json(data);
|
||||
})
|
||||
.catch(({ err }) => {
|
||||
res.status(400).json(err);
|
||||
})
|
||||
: res.status(400).json();
|
||||
|
||||
return apiResponse;
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
import axios from "axios";
|
||||
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 whichForm = req.query.whichForm;
|
||||
var token = await getToken();
|
||||
|
||||
var queryUrl =
|
||||
"systemforms?$select=formid,name,formxml,type,objecttypecode&$filter=(objecttypecode eq 'pinswg_" +
|
||||
whichForm +
|
||||
"' and type eq 2)&$count=true&$top=201";
|
||||
|
||||
return axios
|
||||
.get(
|
||||
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
||||
azureHeaders(token.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 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,55 @@
|
||||
import axios from "axios";
|
||||
import CryptoJS from "crypto-js";
|
||||
import _ from "lodash";
|
||||
import { getToken, azureHeadersPaged } from "../../../actions";
|
||||
|
||||
const WORDKEY = process.env.HASHKEY;
|
||||
|
||||
const WEBAPI_URL =
|
||||
process.env.RELAY_ROOT ||
|
||||
"https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/";
|
||||
|
||||
const hashAPIPath = (queryPath) => {
|
||||
var hashlink = CryptoJS.HmacSHA256(
|
||||
queryPath,
|
||||
CryptoJS.enc.Hex.parse(WORDKEY)
|
||||
);
|
||||
hashlink = hashlink.toString(CryptoJS.enc.Hex);
|
||||
return (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";
|
||||
|
||||
console.log(_.isEmpty(req.query));
|
||||
|
||||
var apiResponse = _.isEmpty(req.query)
|
||||
? res.status(400).json()
|
||||
: typeof emailAddress != "undefined" &&
|
||||
emailAddress.length > 0 &&
|
||||
typeof pwd != "undefined" &&
|
||||
pwd.length > 0
|
||||
? axios
|
||||
.get(
|
||||
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
||||
azureHeadersPaged(token.access_token)
|
||||
)
|
||||
.then(({ data }) => {
|
||||
res.status(200).json(data);
|
||||
})
|
||||
.catch(({ err }) => {
|
||||
res.status(400).json(err);
|
||||
})
|
||||
: res.status(400).json();
|
||||
|
||||
return apiResponse;
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
import axios from "axios";
|
||||
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 = await getToken();
|
||||
|
||||
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.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 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 whichForm = req.query.whichForm;
|
||||
var token = await getToken();
|
||||
|
||||
var queryUrl =
|
||||
"EntityDefinitions(LogicalName='pinswg_" +
|
||||
whichForm +
|
||||
"')/Attributes?$count=true&$select=LogicalName,RequiredLevel";
|
||||
|
||||
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 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 =
|
||||
"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.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 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_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,40 @@
|
||||
import axios from "axios";
|
||||
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_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,45 @@
|
||||
import axios from "axios";
|
||||
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 = await getToken();
|
||||
|
||||
var queryUrl =
|
||||
"contacts(" +
|
||||
contactid +
|
||||
")?$select=firstname, lastname, emailaddress1, telephone1, company, address1_line1,address1_line2,address1_city, address1_county,address1_postalcode&$count=true";
|
||||
|
||||
var apiResponse =
|
||||
contactid.length > 0
|
||||
? axios
|
||||
.get(
|
||||
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
||||
azureHeaders(token.access_token)
|
||||
)
|
||||
.then(({ data }) => {
|
||||
res.status(200).json(data);
|
||||
})
|
||||
.catch(({ err }) => {
|
||||
res.status(400).json(err);
|
||||
})
|
||||
: res.status(400).json();
|
||||
|
||||
return apiResponse;
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
import axios from "axios";
|
||||
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 whichForm = req.query.whichForm;
|
||||
var token = await getToken();
|
||||
|
||||
var queryUrl =
|
||||
"EntityDefinitions(LogicalName='pinswg_" +
|
||||
whichForm +
|
||||
"')/Attributes/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?$select=LogicalName&$expand=OptionSet,GlobalOptionSet&$count=true";
|
||||
|
||||
return axios
|
||||
.get(
|
||||
WEBAPI_URL + queryUrl + hashAPIPath(queryUrl),
|
||||
azureHeaders(token.access_token)
|
||||
)
|
||||
.then(({ data }) => {
|
||||
res.status(200).json(data);
|
||||
})
|
||||
.catch(({ err }) => {
|
||||
res.status(400).json(err);
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
import axios from "axios";
|
||||
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,42 @@
|
||||
import axios from "axios";
|
||||
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 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,40 @@
|
||||
import axios from "axios";
|
||||
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 = await getToken();
|
||||
|
||||
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.access_token)
|
||||
)
|
||||
.then(({ data }) => {
|
||||
res.status(200).json(data);
|
||||
})
|
||||
.catch(({ err }) => {
|
||||
res.status(400).json(err);
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
import axios from "axios";
|
||||
import CryptoJS from "crypto-js";
|
||||
import _ from "lodash";
|
||||
import { getToken, azureHeadersPaged } from "../../../actions";
|
||||
|
||||
const WORDKEY = process.env.HASHKEY;
|
||||
|
||||
const WEBAPI_URL =
|
||||
process.env.RELAY_ROOT ||
|
||||
"https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/";
|
||||
|
||||
const hashAPIPath = (queryPath) => {
|
||||
var hashlink = CryptoJS.HmacSHA256(
|
||||
queryPath,
|
||||
CryptoJS.enc.Hex.parse(WORDKEY)
|
||||
);
|
||||
hashlink = hashlink.toString(CryptoJS.enc.Hex);
|
||||
|
||||
//return "&hash=" + hashlink;
|
||||
|
||||
return (queryPath.indexOf("?") > -1 ? "&hash=" : "?hash=") + hashlink;
|
||||
};
|
||||
|
||||
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
|
||||
);
|
||||
});
|
||||
var dataStr;
|
||||
_.has(data, "@odata.nextLink") == true &&
|
||||
((dataStr = JSON.stringify(data["@odata.nextLink"])),
|
||||
(data["@odata.nextLink"] = dataStr.split("/v8.2/")[1]));
|
||||
|
||||
res.status(200).json(data);
|
||||
})
|
||||
.catch(({ err }) => {
|
||||
res.status(400).json(err);
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
import axios from "axios";
|
||||
import CryptoJS from "crypto-js";
|
||||
import _ from "lodash";
|
||||
import { getToken, azureHeadersPaged } from "../../../actions";
|
||||
|
||||
const WORDKEY = process.env.HASHKEY;
|
||||
|
||||
const WEBAPI_URL =
|
||||
process.env.RELAY_ROOT ||
|
||||
"https://dev-pedw-ns.servicebus.windows.net/dev-pedw-hc/";
|
||||
|
||||
const hashAPIPath = (queryPath) => {
|
||||
var hashlink = CryptoJS.HmacSHA256(
|
||||
queryPath,
|
||||
CryptoJS.enc.Hex.parse(WORDKEY)
|
||||
);
|
||||
hashlink = hashlink.toString(CryptoJS.enc.Hex);
|
||||
|
||||
//return "&hash=" + hashlink;
|
||||
|
||||
return (queryPath.indexOf("?") > -1 ? "&hash=" : "?hash=") + hashlink;
|
||||
};
|
||||
|
||||
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
|
||||
);
|
||||
});
|
||||
var dataStr;
|
||||
_.has(data, "@odata.nextLink") == true &&
|
||||
((dataStr = JSON.stringify(data["@odata.nextLink"])),
|
||||
(data["@odata.nextLink"] = dataStr.split("/v8.2/")[1]));
|
||||
return res.status(200).json(data);
|
||||
})
|
||||
.catch(({ err }) => {
|
||||
res.status(400).json(err);
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
import axios from "axios";
|
||||
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,47 @@
|
||||
import axios from "axios";
|
||||
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,40 @@
|
||||
import axios from "axios";
|
||||
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,40 @@
|
||||
import axios from "axios";
|
||||
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,40 @@
|
||||
import axios from "axios";
|
||||
import CryptoJS from "crypto-js";
|
||||
import { azureHeaders, getToken } 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 CryptoJS from "crypto-js";
|
||||
import { getToken } 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 CryptoJS from "crypto-js";
|
||||
import { getToken } 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 CryptoJS from "crypto-js";
|
||||
import { getToken } 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,21 +1,12 @@
|
||||
import _ from "lodash";
|
||||
import { useState, useEffect, useRef } from "react";
|
||||
import useTranslation from "next-translate/useTranslation";
|
||||
import Head from "next/head";
|
||||
import { useRouter } from "next/router";
|
||||
import Breadcrumbs from "../components/breadcrumbs";
|
||||
import CookieBanner from "../components/cookieBanner";
|
||||
import CookiePolicy from "../components/cookiePolicy";
|
||||
import Footer from "../components/footer";
|
||||
import Header from "../components/header";
|
||||
import ServiceBanner from "../components/servicebanner";
|
||||
import CookieBanner from "../components/cookieBanner";
|
||||
import Breadcrumbs from "../components/breadcrumbs";
|
||||
import Main from "../components/main";
|
||||
import Footer from "../components/footer";
|
||||
import Errorpage from "../components/errorpage";
|
||||
import styles from "../styles/Home.module.css";
|
||||
import { useSelector, shallowEqual, connect } from "react-redux";
|
||||
import { wrapper } from "../store/store";
|
||||
import { useRouter } from "next/router";
|
||||
import useTranslation from "next-translate/useTranslation";
|
||||
import { getIncidents } from "../actions";
|
||||
import { parseCookies } from "nookies";
|
||||
import CookiePolicy from "../components/cookiePolicy";
|
||||
|
||||
const CookieDetails = (props) => {
|
||||
const { footerLinks, pages, showLogin } = props;
|
||||
|
||||
+11
-44
@@ -1,30 +1,20 @@
|
||||
import _ from "lodash";
|
||||
import useTranslation from "next-translate/useTranslation";
|
||||
import Head from "next/head";
|
||||
import Header from "../components/header";
|
||||
import Banner from "../components/banner";
|
||||
import CookieBanner from "../components/cookieBanner";
|
||||
import { useRouter } from "next/router";
|
||||
import { connect } from "react-redux";
|
||||
import { getBasicDNSSearch } from "../actions";
|
||||
import Breadcrumbs from "../components/breadcrumbs";
|
||||
import CookieBanner from "../components/cookieBanner";
|
||||
import DNSSearchResults from "../components/dnssearchresults";
|
||||
import Footer from "../components/footer";
|
||||
import Errorpage from "../components/errorpage";
|
||||
import styles from "../styles/Home.module.css";
|
||||
import { useSelector, shallowEqual, connect } from "react-redux";
|
||||
import { wrapper } from "../store/store";
|
||||
|
||||
import { useRouter } from "next/router";
|
||||
import useTranslation from "next-translate/useTranslation";
|
||||
import jsonpath from "jsonpath";
|
||||
import data from "../data/collections.json";
|
||||
|
||||
import Header from "../components/header";
|
||||
import { getSearchDetails } from "../components/utils";
|
||||
|
||||
import { setSearch, getSearchObj } from "../store/search/action";
|
||||
import { setSearch } from "../store/search/action";
|
||||
import {
|
||||
setSearchResults,
|
||||
setSearchDetails,
|
||||
getSearchResultsObj,
|
||||
setSearchResults,
|
||||
} from "../store/searchOutput/action";
|
||||
import { getBasicDNSSearch, getBasicSearchDetails, getToken } from "../actions";
|
||||
import { wrapper } from "../store/store";
|
||||
|
||||
const Home = (props) => {
|
||||
const { footerLinks, pages } = props;
|
||||
@@ -128,26 +118,7 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
||||
"public, s-maxage=10, stale-while-revalidate=59"
|
||||
);
|
||||
|
||||
let token = await getToken();
|
||||
|
||||
var tokenIssuedAt = new Date();
|
||||
var tokenExpiryTimeAt = new Date();
|
||||
tokenExpiryTimeAt.setSeconds(
|
||||
tokenExpiryTimeAt.getSeconds() + token.expires_in
|
||||
);
|
||||
|
||||
console.log(
|
||||
"token issued:",
|
||||
tokenIssuedAt.toUTCString(),
|
||||
"\n",
|
||||
"token expires:",
|
||||
tokenExpiryTimeAt.toUTCString()
|
||||
);
|
||||
console.log(token);
|
||||
|
||||
token = token.access_token;
|
||||
|
||||
let searchResultsObj = await getBasicDNSSearch(token);
|
||||
let searchResultsObj = await getBasicDNSSearch();
|
||||
searchResultsObj =
|
||||
searchResultsObj.status == 502
|
||||
? {
|
||||
@@ -157,11 +128,7 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
||||
}
|
||||
: searchResultsObj;
|
||||
|
||||
const searchDetailsObj = await getSearchDetails(
|
||||
token,
|
||||
searchResultsObj
|
||||
);
|
||||
//console.log(searchDetailsObj);
|
||||
const searchDetailsObj = await getSearchDetails(searchResultsObj);
|
||||
store.dispatch(setSearchResults(searchResultsObj));
|
||||
store.dispatch(setSearchDetails(searchDetailsObj));
|
||||
store.dispatch(setSearch("DNS"));
|
||||
|
||||
+7
-14
@@ -1,19 +1,12 @@
|
||||
import _ from "lodash";
|
||||
import Head from "next/head";
|
||||
import Header from "../components/header";
|
||||
import Banner from "../components/banner";
|
||||
import CookieBanner from "../components/cookieBanner";
|
||||
import Breadcrumbs from "../components/breadcrumbs";
|
||||
import CaseSummary from "../components/case";
|
||||
import Footer from "../components/footer";
|
||||
import Errorpage from "../components/errorpage";
|
||||
import styles from "../styles/Home.module.css";
|
||||
import { useSelector, shallowEqual, connect } from "react-redux";
|
||||
import { wrapper } from "../store/store";
|
||||
|
||||
import { useRouter } from "next/router";
|
||||
import useTranslation from "next-translate/useTranslation";
|
||||
import Head from "next/head";
|
||||
import { useRouter } from "next/router";
|
||||
import { connect } from "react-redux";
|
||||
import Breadcrumbs from "../components/breadcrumbs";
|
||||
import Case from "../components/case";
|
||||
import CookieBanner from "../components/cookieBanner";
|
||||
import Footer from "../components/footer";
|
||||
import Header from "../components/header";
|
||||
|
||||
const Home = (props) => {
|
||||
const { footerLinks, pages } = props;
|
||||
|
||||
+174
-23
@@ -1,28 +1,71 @@
|
||||
import _ from "lodash";
|
||||
import { useState, useEffect, useRef } from "react";
|
||||
import Head from "next/head";
|
||||
import Header from "../components/header";
|
||||
import ServiceBanner from "../components/servicebanner";
|
||||
import CookieBanner from "../components/cookieBanner";
|
||||
import Breadcrumbs from "../components/breadcrumbs";
|
||||
import Main from "../components/main";
|
||||
import Footer from "../components/footer";
|
||||
import Errorpage from "../components/errorpage";
|
||||
import styles from "../styles/Home.module.css";
|
||||
import { useSelector, shallowEqual, connect } from "react-redux";
|
||||
import { wrapper } from "../store/store";
|
||||
import { useRouter } from "next/router";
|
||||
import useTranslation from "next-translate/useTranslation";
|
||||
import { getIncidents } from "../actions";
|
||||
import { parseCookies } from "nookies";
|
||||
import Head from "next/head";
|
||||
import { useRouter } from "next/router";
|
||||
import { setCookie } from "nookies";
|
||||
import { connect } from "react-redux";
|
||||
import { getToken, hashString } from "../actions";
|
||||
import {
|
||||
getGGToken,
|
||||
getPortalLogin,
|
||||
getProviderConfig,
|
||||
getUserInfo,
|
||||
} from "../actions/govgateway";
|
||||
import CookieBanner from "../components/cookieBanner";
|
||||
import Footer from "../components/footer";
|
||||
import Header from "../components/header";
|
||||
import Main from "../components/main";
|
||||
import ServiceBanner from "../components/servicebanner";
|
||||
import { setAccountDetails } from "../store/accountDetails/action";
|
||||
import { getGovGatewayConfig } from "../store/govgateway/action";
|
||||
import { wrapper } from "../store/store";
|
||||
|
||||
const Home = (props) => {
|
||||
const { footerLinks, pages, showLogin } = props;
|
||||
const {
|
||||
footerLinks,
|
||||
pages,
|
||||
showLogin,
|
||||
loggedInUserId,
|
||||
hasGGCode,
|
||||
loginEmailStr,
|
||||
loggedInUserEmail,
|
||||
ggLocale,
|
||||
} = props;
|
||||
let { t, lang } = useTranslation();
|
||||
|
||||
const router = useRouter();
|
||||
const { locale } = router;
|
||||
|
||||
let now = new Date();
|
||||
let expDate = new Date(now);
|
||||
expDate.setDate(now.getDate() + 1);
|
||||
|
||||
//console.log("hashed email str", loginEmailStr);
|
||||
_.isEmpty(loggedInUserId) != false && !hasGGCode
|
||||
? console.log("no ggcode")
|
||||
: _.has(loggedInUserId, "value")
|
||||
? _.isEmpty(loggedInUserId.value)
|
||||
? router.replace({
|
||||
pathname:
|
||||
router.locale == "cy"
|
||||
? "/account/register"
|
||||
: "/account/register",
|
||||
query: {
|
||||
id: encodeURI(loggedInUserEmail),
|
||||
},
|
||||
})
|
||||
: (setCookie(null, "pinsUser", loggedInUserId.value[0].contactid, {
|
||||
path: "/",
|
||||
expires: expDate,
|
||||
}),
|
||||
router.replace({
|
||||
pathname:
|
||||
router.locale == "cy" || ggLocale == "cy"
|
||||
? "/cy/fymhorth"
|
||||
: "/myportal",
|
||||
}))
|
||||
: console.log("no value in user id");
|
||||
|
||||
return (
|
||||
<div>
|
||||
<Head>
|
||||
@@ -77,8 +120,32 @@ const Home = (props) => {
|
||||
<CookieBanner />
|
||||
<Header courseName="Appeals Casework Portal" />
|
||||
<div className="govuk-width-container">
|
||||
<ServiceBanner />
|
||||
<Main pages={pages} showLogin={showLogin} />
|
||||
{hasGGCode ? (
|
||||
<>
|
||||
<h1>
|
||||
{ggLocale == "cy"
|
||||
? "Mewngofnodi"
|
||||
: "Logging in"}
|
||||
</h1>
|
||||
<h2>
|
||||
{ggLocale == "cy"
|
||||
? "Arhoswch os gwelwch yn dda..."
|
||||
: "Please wait..."}
|
||||
</h2>
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<ServiceBanner />
|
||||
<Main
|
||||
ggLocale={ggLocale}
|
||||
pages={pages}
|
||||
showLogin={showLogin}
|
||||
loggedInUserId={loggedInUserId}
|
||||
GG_REDIRECT_URI={props.GG_REDIRECT_URI}
|
||||
GG_CLIENT_ID={props.GG_CLIENT_ID}
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
<Footer footerLinks={footerLinks} />
|
||||
</div>
|
||||
@@ -90,13 +157,97 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
||||
(store) => async (ctx) => {
|
||||
const { query, req, res } = ctx;
|
||||
|
||||
var relayToken = await getToken();
|
||||
relayToken = relayToken.access_token;
|
||||
|
||||
console.log("gg code:", query.code);
|
||||
console.log("gg local", query.ui_locales);
|
||||
|
||||
const showLoginCheck = process.env.SHOWLOGIN || false;
|
||||
|
||||
console.log("Show login module: ", showLoginCheck);
|
||||
const hasLoginCode = typeof query.code != "undefined";
|
||||
let providerConfig = await getProviderConfig();
|
||||
let ggLocale =
|
||||
typeof query.ui_locales != "undefined" && query.ui_locales;
|
||||
|
||||
return {
|
||||
props: { showLogin: showLoginCheck },
|
||||
};
|
||||
console.log(
|
||||
"endpoint: ",
|
||||
providerConfig.token_endpoint,
|
||||
"\n",
|
||||
"hasloginCode:",
|
||||
hasLoginCode,
|
||||
"\n",
|
||||
"redirect:",
|
||||
process.env.GG_REDIRECT_URI
|
||||
);
|
||||
|
||||
store.dispatch(getGovGatewayConfig(providerConfig));
|
||||
|
||||
let ggToken = {};
|
||||
let ggUserInfo = {};
|
||||
let portalUserObj = {};
|
||||
let loginEmailStr = "";
|
||||
|
||||
if (hasLoginCode == true) {
|
||||
ggToken = await getGGToken(
|
||||
providerConfig.token_endpoint,
|
||||
query.code,
|
||||
process.env.GG_REDIRECT_URI
|
||||
);
|
||||
|
||||
_.has(ggToken, "access_token")
|
||||
? ((ggUserInfo = await getUserInfo(
|
||||
providerConfig.userinfo_endpoint,
|
||||
ggToken.access_token
|
||||
)),
|
||||
(loginEmailStr = hashString(ggUserInfo.data.email)),
|
||||
(portalUserObj = await getPortalLogin(
|
||||
ggUserInfo.data.email,
|
||||
relayToken
|
||||
)),
|
||||
console.log("loggin user stuff: ", portalUserObj),
|
||||
store.dispatch(setAccountDetails(portalUserObj)))
|
||||
: console.log(
|
||||
ggToken.status + " " + ggToken.data.error_description
|
||||
);
|
||||
}
|
||||
|
||||
if (ggToken.status == 400) {
|
||||
return {
|
||||
redirect: {
|
||||
destination: "/myportal/error",
|
||||
permanent: false,
|
||||
},
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
props: {
|
||||
ggLocale: ggLocale,
|
||||
showLogin: showLoginCheck,
|
||||
hasGGCode: hasLoginCode,
|
||||
loggedInUserId: portalUserObj,
|
||||
loggedInUserEmail: loginEmailStr,
|
||||
GG_REDIRECT_URI: process.env.GG_REDIRECT_URI,
|
||||
GG_CLIENT_ID: process.env.GG_CLIENT_ID,
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
);
|
||||
export default Home; //connect(mapStateToProps)(Home);
|
||||
|
||||
const mapStateToProps = (state) => {
|
||||
return {
|
||||
currentView: state.currentView,
|
||||
search: state.search,
|
||||
searchResultsObj: state.searchResultsObj,
|
||||
formData: state.formData,
|
||||
appealType: state.appealType,
|
||||
form: state.form,
|
||||
myCases: state.myCases,
|
||||
watchedCases: state.watchedCases,
|
||||
myRepresentations: state.myRepresentations,
|
||||
awaitingSubmission: state.awaitingSubmission,
|
||||
govGateway: state.govGateway,
|
||||
};
|
||||
};
|
||||
export default connect(mapStateToProps)(Home);
|
||||
|
||||
+8
-11
@@ -1,16 +1,13 @@
|
||||
import _ from "lodash";
|
||||
import Link from "next/link";
|
||||
import Head from "next/head";
|
||||
import Header from "../components/header";
|
||||
import Banner from "../components/banner";
|
||||
import CookieBanner from "../components/cookieBanner";
|
||||
|
||||
import Footer from "../components/footer";
|
||||
import { useSelector, shallowEqual, connect } from "react-redux";
|
||||
import { useRouter } from "next/router";
|
||||
import useTranslation from "next-translate/useTranslation";
|
||||
import { setLogout } from "../store/accountDetails/action";
|
||||
import Head from "next/head";
|
||||
import Link from "next/link";
|
||||
import { useRouter } from "next/router";
|
||||
import { useEffect } from "react";
|
||||
import { connect } from "react-redux";
|
||||
import CookieBanner from "../components/cookieBanner";
|
||||
import Footer from "../components/footer";
|
||||
import Header from "../components/header";
|
||||
import { setLogout } from "../store/accountDetails/action";
|
||||
|
||||
const LogOut = (props) => {
|
||||
const { footerLinks, pages, setLogout } = props;
|
||||
|
||||
@@ -1,36 +1,18 @@
|
||||
import _ from "lodash";
|
||||
import { useState } from "react";
|
||||
import Head from "next/head";
|
||||
import Header from "../../components/header";
|
||||
import Banner from "../../components/banner";
|
||||
import CookieBanner from "../../components/cookieBanner";
|
||||
import Breadcrumbs from "../../components/breadcrumbs";
|
||||
import Search from "../../components/search";
|
||||
import Footer from "../../components/footer";
|
||||
import Errorpage from "../../components/errorpage";
|
||||
import styles from "../../styles/Home.module.css";
|
||||
import { useSelector, shallowEqual, connect } from "react-redux";
|
||||
import { wrapper } from "../../store/store";
|
||||
|
||||
import { useRouter } from "next/router";
|
||||
import useTranslation from "next-translate/useTranslation";
|
||||
import Head from "next/head";
|
||||
import { useRouter } from "next/router";
|
||||
import { connect } from "react-redux";
|
||||
import { getAppealsTypes, getLPA } from "../../actions";
|
||||
import Breadcrumbs from "../../components/breadcrumbs";
|
||||
import CookieBanner from "../../components/cookieBanner";
|
||||
import CRMError from "../../components/crmError";
|
||||
|
||||
import {
|
||||
setAppealType,
|
||||
setAppealTypeTitle,
|
||||
setAppealTypeID,
|
||||
setAppealLPA,
|
||||
getAppealTypeObj,
|
||||
} from "../../store/appealType/action";
|
||||
import {
|
||||
getAppealsTypes,
|
||||
getLPA,
|
||||
updateCase,
|
||||
createCase,
|
||||
getToken,
|
||||
} from "../../actions";
|
||||
import Footer from "../../components/footer";
|
||||
import Header from "../../components/header";
|
||||
import Search from "../../components/search";
|
||||
import { setAppealType } from "../../store/appealType/action";
|
||||
import { setLPA } from "../../store/lpa/action";
|
||||
import { wrapper } from "../../store/store";
|
||||
|
||||
const Home = (props) => {
|
||||
const { footerLinks, pages } = props;
|
||||
@@ -40,7 +22,6 @@ const Home = (props) => {
|
||||
const { locale } = router;
|
||||
const { appealtypes } = router.query;
|
||||
|
||||
console.log(props, props.LPAData);
|
||||
var hasError =
|
||||
_.has(props.LPAData.LPAData, "errorCode") ||
|
||||
_.has(props.appealType.appealType, "errorCode")
|
||||
@@ -77,12 +58,9 @@ const Home = (props) => {
|
||||
export const getServerSideProps = wrapper.getServerSideProps(
|
||||
(store) =>
|
||||
async ({ query, req, res }) => {
|
||||
let token = await getToken();
|
||||
token = token.access_token;
|
||||
|
||||
const [appealTypeData, lpaData] = await Promise.all([
|
||||
await getAppealsTypes(token),
|
||||
await getLPA(token),
|
||||
await getAppealsTypes(),
|
||||
await getLPA(),
|
||||
]);
|
||||
|
||||
store.dispatch(setAppealType(appealTypeData));
|
||||
|
||||
@@ -1,31 +1,33 @@
|
||||
import _ from "lodash";
|
||||
import Head from "next/head";
|
||||
import Header from "../../components/header";
|
||||
import Banner from "../../components/banner";
|
||||
import CookieBanner from "../../components/cookieBanner";
|
||||
import Breadcrumbs from "../../components/breadcrumbs";
|
||||
import SearchResults from "../../components/searchresults";
|
||||
import Footer from "../../components/footer";
|
||||
import Errorpage from "../../components/errorpage";
|
||||
import styles from "../../styles/Home.module.css";
|
||||
import { useSelector, shallowEqual, connect } from "react-redux";
|
||||
import { wrapper } from "../../store/store";
|
||||
|
||||
import { useRouter } from "next/router";
|
||||
import useTranslation from "next-translate/useTranslation";
|
||||
import jsonpath from "jsonpath";
|
||||
import data from "../../data/collections.json";
|
||||
|
||||
import { getSearchDetails } from "../../components/utils";
|
||||
import { setSearch, getSearchObj } from "../../store/search/action";
|
||||
import Head from "next/head";
|
||||
import { useRouter } from "next/router";
|
||||
import { connect } from "react-redux";
|
||||
import {
|
||||
getAdvancedSearch,
|
||||
getPortalModuleDetails,
|
||||
getWatchedCases,
|
||||
} from "../../actions";
|
||||
import Breadcrumbs from "../../components/breadcrumbs";
|
||||
import CookieBanner from "../../components/cookieBanner";
|
||||
import Footer from "../../components/footer";
|
||||
import Header from "../../components/header";
|
||||
import SearchResults from "../../components/searchresults";
|
||||
import {
|
||||
getFormCollectionByID,
|
||||
getSearchDetails,
|
||||
} from "../../components/utils";
|
||||
import {
|
||||
setSearchResults,
|
||||
setSearchDetails,
|
||||
setSearchResults,
|
||||
} from "../../store/searchOutput/action";
|
||||
import { getAdvancedSearch, getToken } from "../../actions";
|
||||
import { wrapper } from "../../store/store";
|
||||
import {
|
||||
setWatchedCases,
|
||||
setWatchedCasesDetails,
|
||||
} from "../../store/watchedCases/action";
|
||||
|
||||
const Home = (props) => {
|
||||
const { footerLinks, pages } = props;
|
||||
const { footerLinks, pages, watchedCases } = props;
|
||||
let { t, lang } = useTranslation();
|
||||
|
||||
const router = useRouter();
|
||||
@@ -48,6 +50,8 @@ const Home = (props) => {
|
||||
searchString={props.search.searchString}
|
||||
searchResultsObj={props.searchResultsObj}
|
||||
advancedSearch={true}
|
||||
watchedCases={watchedCases}
|
||||
myportal={true}
|
||||
/>
|
||||
</div>
|
||||
<Footer footerLinks={footerLinks} />
|
||||
@@ -61,21 +65,58 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
||||
async ({ query, req, res }) => {
|
||||
console.log("query-", query);
|
||||
//console.log("search array:", Object.entries(query));
|
||||
const { cookies } = req;
|
||||
|
||||
let token = await getToken();
|
||||
token = token.access_token;
|
||||
let loggedInUser = cookies.pinsUser;
|
||||
|
||||
const searchResultsObj = await getAdvancedSearch(token, query);
|
||||
const searchDetailsObj = await getSearchDetails(
|
||||
token,
|
||||
searchResultsObj
|
||||
);
|
||||
const [searchResultsObj, watchedCases] = await Promise.all([
|
||||
await getAdvancedSearch(query),
|
||||
await getWatchedCases(loggedInUser),
|
||||
]);
|
||||
|
||||
const [searchDetailsObj, watchedCasesDetails] = await Promise.all([
|
||||
await getSearchDetails(searchResultsObj),
|
||||
await getDetails(watchedCases, "myWatchedCases"),
|
||||
]);
|
||||
|
||||
store.dispatch(setSearchResults(searchResultsObj));
|
||||
store.dispatch(setSearchDetails(searchDetailsObj));
|
||||
store.dispatch(setWatchedCases(watchedCases));
|
||||
store.dispatch(setWatchedCasesDetails(watchedCasesDetails));
|
||||
}
|
||||
);
|
||||
|
||||
const getDetails = (resultsObj, detailsType) => {
|
||||
//console.log(resultsObj);
|
||||
let detailsArr = [];
|
||||
resultsObj = resultsObj.value;
|
||||
const detailsObj = resultsObj.map((searchDetail, index) => {
|
||||
if (searchDetail.pinswg_appealcasetype == null) {
|
||||
console.log(
|
||||
detailsType != "myWatchedCases"
|
||||
? searchDetail.ticketnumber
|
||||
: searchDetail[
|
||||
"_pinswg_watchedcase_value@OData.Community.Display.V1.FormattedValue"
|
||||
]
|
||||
);
|
||||
} else {
|
||||
detailsArr.push(
|
||||
getPortalModuleDetails(
|
||||
getFormCollectionByID(searchDetail.pinswg_appealcasetype)
|
||||
.LogicalCollectionName,
|
||||
detailsType != "myWatchedCases"
|
||||
? searchDetail.ticketnumber
|
||||
: searchDetail[
|
||||
"_pinswg_watchedcase_value@OData.Community.Display.V1.FormattedValue"
|
||||
]
|
||||
)
|
||||
);
|
||||
}
|
||||
});
|
||||
//console.log(detailsArr);
|
||||
return Promise.all(detailsArr);
|
||||
};
|
||||
|
||||
const mapStateToProps = (state) => {
|
||||
return {
|
||||
currentView: state.currentView,
|
||||
|
||||
+18
-25
@@ -1,19 +1,12 @@
|
||||
import _ from "lodash";
|
||||
import Head from "next/head";
|
||||
import Header from "../../components/header";
|
||||
import Banner from "../../components/banner";
|
||||
import CookieBanner from "../../components/cookieBanner";
|
||||
import Breadcrumbs from "../../components/breadcrumbs";
|
||||
import CaseSummary from "../../components/case";
|
||||
import Footer from "../../components/footer";
|
||||
import Errorpage from "../../components/errorpage";
|
||||
import styles from "../../styles/Home.module.css";
|
||||
import { useSelector, shallowEqual, connect } from "react-redux";
|
||||
import { wrapper } from "../../store/store";
|
||||
|
||||
import { useRouter } from "next/router";
|
||||
import useTranslation from "next-translate/useTranslation";
|
||||
import Head from "next/head";
|
||||
import { useRouter } from "next/router";
|
||||
import { connect } from "react-redux";
|
||||
import Breadcrumbs from "../../components/breadcrumbs";
|
||||
import Case from "../../components/case";
|
||||
import CookieBanner from "../../components/cookieBanner";
|
||||
import Footer from "../../components/footer";
|
||||
import Header from "../../components/header";
|
||||
|
||||
const Home = (props) => {
|
||||
const { footerLinks, pages, showRepresentations } = props;
|
||||
@@ -85,20 +78,20 @@ const Home = (props) => {
|
||||
);
|
||||
};
|
||||
|
||||
export const getServerSideProps = wrapper.getServerSideProps(
|
||||
(store) => async (ctx) => {
|
||||
const { query, req, res } = ctx;
|
||||
// export const getServerSideProps = wrapper.getServerSideProps(
|
||||
// (store) => async (ctx) => {
|
||||
// const { query, req, res } = ctx;
|
||||
|
||||
const showRepresentationsCheck =
|
||||
process.env.SHOWREPRESENTATIONS || false;
|
||||
// const showRepresentationsCheck =
|
||||
// process.env.SHOWREPRESENTATIONS || false;
|
||||
|
||||
console.log("Show representation module: ", showRepresentationsCheck);
|
||||
// console.log("Show representation module: ", showRepresentationsCheck);
|
||||
|
||||
return {
|
||||
props: { showRepresentations: showRepresentationsCheck },
|
||||
};
|
||||
}
|
||||
);
|
||||
// return {
|
||||
// props: { showRepresentations: showRepresentationsCheck },
|
||||
// };
|
||||
// }
|
||||
// );
|
||||
|
||||
const mapStateToProps = (state) => {
|
||||
//console.log(state);
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
import useTranslation from "next-translate/useTranslation";
|
||||
import Head from "next/head";
|
||||
import Link from "next/link";
|
||||
import CookieBanner from "../../components/cookieBanner";
|
||||
import Footer from "../../components/footer";
|
||||
import Header from "../../components/header";
|
||||
|
||||
function Error({ statusCode }, props) {
|
||||
let { t, lang } = useTranslation();
|
||||
const { footerLinks, pages } = props;
|
||||
|
||||
return (
|
||||
<div>
|
||||
<Head>
|
||||
<title>
|
||||
{t("myportal:page-title")} - {t("common:service-name")}
|
||||
</title>
|
||||
</Head>
|
||||
<div id="page_wrapper">
|
||||
<CookieBanner />
|
||||
<Header courseName={t("common:service-name")} />
|
||||
<div className="govuk-width-container govuk-!-padding-bottom-9">
|
||||
<main className="govuk-main-wrapper govuk-!-padding-top-9 govuk-!-padding-bottom-9">
|
||||
<div className="govuk-grid-row">
|
||||
<div className="govuk-grid-column-two-thirds ">
|
||||
<h1>{t("common:error-page-title")}</h1>
|
||||
<p className="govuk-body">
|
||||
A problem occured when trying to login
|
||||
</p>
|
||||
<Link href="/">
|
||||
<a>{t("common:404-not-found-link")}</a>
|
||||
</Link>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
</div>
|
||||
<Footer footerLinks={footerLinks} />
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
Error.getInitialProps = ({ res, err }) => {
|
||||
const statusCode = res ? res.statusCode : err ? err.statusCode : 404;
|
||||
console.log(res, err);
|
||||
return { statusCode };
|
||||
};
|
||||
|
||||
export default Error;
|
||||
+86
-69
@@ -1,48 +1,39 @@
|
||||
import _ from "lodash";
|
||||
|
||||
import jsonpath from "jsonpath";
|
||||
import Head from "next/head";
|
||||
import Header from "../../components/header";
|
||||
import Banner from "../../components/banner";
|
||||
import CookieBanner from "../../components/cookieBanner";
|
||||
import Breadcrumbs from "../../components/breadcrumbs";
|
||||
import MyPortal from "../../components/myportal";
|
||||
import Footer from "../../components/footer";
|
||||
import Errorpage from "../../components/errorpage";
|
||||
import styles from "../../styles/Home.module.css";
|
||||
import { useSelector, shallowEqual, connect } from "react-redux";
|
||||
import { wrapper } from "../../store/store";
|
||||
import { useRouter } from "next/router";
|
||||
import useTranslation from "next-translate/useTranslation";
|
||||
import data from "../../data/collections.json";
|
||||
import nookies from "nookies";
|
||||
import Head from "next/head";
|
||||
import { useRouter } from "next/router";
|
||||
import { connect } from "react-redux";
|
||||
import {
|
||||
getAwaitingSubmission,
|
||||
getMyCases,
|
||||
getMyRepresentations,
|
||||
getPersonalAccount,
|
||||
getPortalModuleDetails,
|
||||
getWatchedCases,
|
||||
} from "../../actions";
|
||||
import { getProviderConfig } from "../../actions/govgateway";
|
||||
import Breadcrumbs from "../../components/breadcrumbs";
|
||||
import CookieBanner from "../../components/cookieBanner";
|
||||
import Footer from "../../components/footer";
|
||||
import Header from "../../components/header";
|
||||
import MyPortal from "../../components/myportal";
|
||||
import { getFormCollectionByID } from "../../components/utils";
|
||||
import {
|
||||
setLoggedInUserId,
|
||||
setAccountDetails,
|
||||
setLoggedInUserId,
|
||||
} from "../../store/accountDetails/action";
|
||||
import { setAwaitingSubmission } from "../../store/awaitingSubmission/action";
|
||||
import { getGovGatewayConfig } from "../../store/govgateway/action";
|
||||
import { setMyCases, setMyCasesDetails } from "../../store/myCases/action";
|
||||
import {
|
||||
setMyRepresentations,
|
||||
setMyRepresentationsDetails,
|
||||
} from "../../store/myRepresentations/action";
|
||||
import { wrapper } from "../../store/store";
|
||||
import {
|
||||
setWatchedCases,
|
||||
setWatchedCasesDetails,
|
||||
} from "../../store/watchedCases/action";
|
||||
import {
|
||||
setAwaitingSubmission,
|
||||
setAwaitingSubmissionDetails,
|
||||
} from "../../store/awaitingSubmission/action";
|
||||
import {
|
||||
getToken,
|
||||
getPersonalAccount,
|
||||
getMyCases,
|
||||
getMyRepresentations,
|
||||
getWatchedCases,
|
||||
getAwaitingSubmission,
|
||||
getPortalModuleDetails,
|
||||
} from "../../actions";
|
||||
|
||||
const Home = (props) => {
|
||||
const {
|
||||
@@ -52,6 +43,8 @@ const Home = (props) => {
|
||||
myRepresentations,
|
||||
watchedCases,
|
||||
awaitingSubmission,
|
||||
accountDetails,
|
||||
govGateway,
|
||||
} = props;
|
||||
let { t, lang } = useTranslation();
|
||||
|
||||
@@ -137,6 +130,8 @@ const Home = (props) => {
|
||||
myRepresentations={myRepresentations}
|
||||
watchedCases={watchedCases}
|
||||
awaitingSubmission={awaitingSubmission}
|
||||
accountDetails={accountDetails}
|
||||
ggLogout={govGateway.config.end_session_endpoint}
|
||||
/>
|
||||
</div>
|
||||
<Footer footerLinks={footerLinks} />
|
||||
@@ -148,17 +143,24 @@ const Home = (props) => {
|
||||
export const getServerSideProps = wrapper.getServerSideProps(
|
||||
(store) => async (ctx) => {
|
||||
const { query, req, res } = ctx;
|
||||
console.log("the query", query);
|
||||
console.log("The query", query);
|
||||
|
||||
const { cookies } = req;
|
||||
|
||||
console.log("the cookoies", cookies);
|
||||
|
||||
let token = await getToken();
|
||||
token = token.access_token;
|
||||
|
||||
let loggedInUser = cookies.pinsUser;
|
||||
|
||||
let providerConfig = await getProviderConfig();
|
||||
|
||||
// console.log(
|
||||
// "logout endpoint: ",
|
||||
// providerConfig.end_session_endpoint,
|
||||
// "\n",
|
||||
// "redirect:",
|
||||
// process.env.GG_REDIRECT_URI
|
||||
//);
|
||||
|
||||
store.dispatch(getGovGatewayConfig(providerConfig));
|
||||
|
||||
const [
|
||||
accountDetails,
|
||||
myCases,
|
||||
@@ -166,44 +168,60 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
||||
watchedCases,
|
||||
awaitingSubmission,
|
||||
] = await Promise.all([
|
||||
await getPersonalAccount(token, loggedInUser),
|
||||
await getMyCases(token, loggedInUser),
|
||||
await getMyRepresentations(token, loggedInUser),
|
||||
await getWatchedCases(token, loggedInUser),
|
||||
await getAwaitingSubmission(token),
|
||||
await getPersonalAccount(loggedInUser),
|
||||
await getMyCases(loggedInUser),
|
||||
await getMyRepresentations(loggedInUser),
|
||||
await getWatchedCases(loggedInUser),
|
||||
await getAwaitingSubmission(),
|
||||
]);
|
||||
|
||||
//const cookiesMaker = nookies.get(ctx)
|
||||
console.log(accountDetails);
|
||||
const [
|
||||
myCasesDetails,
|
||||
myRepresentationsDetails,
|
||||
watchedCasesDetails,
|
||||
// awaitingSubmissionDetails,
|
||||
] = await Promise.all([
|
||||
await getDetails(token, myCases, "myCases"),
|
||||
await getDetails(token, myRepresentations, "myRepresentations"),
|
||||
await getDetails(token, watchedCases, "myWatchedCases"),
|
||||
// await getDetails(awaitingSubmission),
|
||||
]);
|
||||
|
||||
store.dispatch(setAccountDetails(accountDetails));
|
||||
store.dispatch(setLoggedInUserId(loggedInUser));
|
||||
store.dispatch(setMyCases(myCases));
|
||||
store.dispatch(setMyCasesDetails(myCasesDetails));
|
||||
store.dispatch(setMyRepresentations(myRepresentations));
|
||||
store.dispatch(setMyRepresentationsDetails(myRepresentationsDetails));
|
||||
store.dispatch(setWatchedCases(watchedCases));
|
||||
store.dispatch(setWatchedCasesDetails(watchedCasesDetails));
|
||||
store.dispatch(setAwaitingSubmission(awaitingSubmission));
|
||||
// store.dispatch(
|
||||
// setAwaitingSubmissionDetails(awaitingSubmissionDetails)
|
||||
// console.log(
|
||||
// "acc details:",
|
||||
// accountDetails,
|
||||
// _.has(accountDetails, "errorCode") != false
|
||||
// );
|
||||
|
||||
if (_.has(accountDetails, "errorCode") != false) {
|
||||
return {
|
||||
redirect: {
|
||||
destination: "/myportal/error",
|
||||
permanent: false,
|
||||
},
|
||||
};
|
||||
} else {
|
||||
const [
|
||||
myCasesDetails,
|
||||
myRepresentationsDetails,
|
||||
watchedCasesDetails,
|
||||
// awaitingSubmissionDetails,
|
||||
] = await Promise.all([
|
||||
await getDetails(myCases, "myCases"),
|
||||
await getDetails(myRepresentations, "myRepresentations"),
|
||||
await getDetails(watchedCases, "myWatchedCases"),
|
||||
//await getDetails(awaitingSubmission),
|
||||
]);
|
||||
|
||||
store.dispatch(setAccountDetails(accountDetails));
|
||||
store.dispatch(setLoggedInUserId(loggedInUser));
|
||||
store.dispatch(setMyCases(myCases));
|
||||
store.dispatch(setMyCasesDetails(myCasesDetails));
|
||||
store.dispatch(setMyRepresentations(myRepresentations));
|
||||
store.dispatch(
|
||||
setMyRepresentationsDetails(myRepresentationsDetails)
|
||||
);
|
||||
store.dispatch(setWatchedCases(watchedCases));
|
||||
store.dispatch(setWatchedCasesDetails(watchedCasesDetails));
|
||||
store.dispatch(setAwaitingSubmission(awaitingSubmission));
|
||||
// store.dispatch(
|
||||
// setAwaitingSubmissionDetails(awaitingSubmissionDetails)
|
||||
// );
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
const getDetails = (token, resultsObj, detailsType) => {
|
||||
console.log(resultsObj);
|
||||
const getDetails = (resultsObj, detailsType) => {
|
||||
console.log(detailsType);
|
||||
let detailsArr = [];
|
||||
resultsObj = resultsObj.value;
|
||||
const detailsObj = resultsObj.map((searchDetail, index) => {
|
||||
@@ -218,7 +236,6 @@ const getDetails = (token, resultsObj, detailsType) => {
|
||||
} else {
|
||||
detailsArr.push(
|
||||
getPortalModuleDetails(
|
||||
token,
|
||||
getFormCollectionByID(searchDetail.pinswg_appealcasetype)
|
||||
.LogicalCollectionName,
|
||||
detailsType != "myWatchedCases"
|
||||
@@ -230,7 +247,6 @@ const getDetails = (token, resultsObj, detailsType) => {
|
||||
);
|
||||
}
|
||||
});
|
||||
//console.log(detailsArr);
|
||||
return Promise.all(detailsArr);
|
||||
};
|
||||
|
||||
@@ -249,6 +265,7 @@ const mapStateToProps = (state) => {
|
||||
watchedCases: state.watchedCases,
|
||||
myRepresentations: state.myRepresentations,
|
||||
awaitingSubmission: state.awaitingSubmission,
|
||||
govGateway: state.govGateway,
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@@ -1,18 +1,11 @@
|
||||
import _ from "lodash";
|
||||
import Head from "next/head";
|
||||
import Header from "../../components/header";
|
||||
import Banner from "../../components/banner";
|
||||
import CookieBanner from "../../components/cookieBanner";
|
||||
import Breadcrumbs from "../../components/breadcrumbs";
|
||||
import CaseSummary from "../../components/case";
|
||||
import Footer from "../../components/footer";
|
||||
import Errorpage from "../../components/errorpage";
|
||||
import styles from "../../styles/Home.module.css";
|
||||
import { useSelector, shallowEqual, connect } from "react-redux";
|
||||
import { wrapper } from "../../store/store";
|
||||
|
||||
import { useRouter } from "next/router";
|
||||
import useTranslation from "next-translate/useTranslation";
|
||||
import Head from "next/head";
|
||||
import { useRouter } from "next/router";
|
||||
import { connect } from "react-redux";
|
||||
import Breadcrumbs from "../../components/breadcrumbs";
|
||||
import CookieBanner from "../../components/cookieBanner";
|
||||
import Footer from "../../components/footer";
|
||||
import Header from "../../components/header";
|
||||
import Case from "../../components/representation";
|
||||
|
||||
const Home = (props) => {
|
||||
|
||||
@@ -1,46 +1,31 @@
|
||||
import _ from "lodash";
|
||||
import Head from "next/head";
|
||||
import Header from "../../components/header";
|
||||
import Banner from "../../components/banner";
|
||||
import CookieBanner from "../../components/cookieBanner";
|
||||
import Breadcrumbs from "../../components/breadcrumbs";
|
||||
import SearchResults from "../../components/searchresults";
|
||||
import Footer from "../../components/footer";
|
||||
import Errorpage from "../../components/errorpage";
|
||||
import styles from "../../styles/Home.module.css";
|
||||
import { useSelector, shallowEqual, connect } from "react-redux";
|
||||
import { wrapper } from "../../store/store";
|
||||
|
||||
import { useRouter } from "next/router";
|
||||
import useTranslation from "next-translate/useTranslation";
|
||||
import jsonpath from "jsonpath";
|
||||
import data from "../../data/collections.json";
|
||||
|
||||
import Head from "next/head";
|
||||
import { useRouter } from "next/router";
|
||||
import { connect } from "react-redux";
|
||||
import {
|
||||
getBasicSearch,
|
||||
getPortalModuleDetails,
|
||||
getWatchedCases,
|
||||
} from "../../actions";
|
||||
import Breadcrumbs from "../../components/breadcrumbs";
|
||||
import CookieBanner from "../../components/cookieBanner";
|
||||
import Footer from "../../components/footer";
|
||||
import Header from "../../components/header";
|
||||
import SearchResults from "../../components/searchresults";
|
||||
import {
|
||||
getSearchDetails,
|
||||
getFormCollectionByID,
|
||||
getSearchDetails,
|
||||
} from "../../components/utils";
|
||||
import { setSearch, getSearchObj } from "../../store/search/action";
|
||||
import { setSearch } from "../../store/search/action";
|
||||
import {
|
||||
setSearchResults,
|
||||
setSearchDetails,
|
||||
setDocumentDetails,
|
||||
setDocumentHistory,
|
||||
getSearchResultsObj,
|
||||
setSearchResults,
|
||||
} from "../../store/searchOutput/action";
|
||||
import { wrapper } from "../../store/store";
|
||||
import {
|
||||
setWatchedCases,
|
||||
setWatchedCasesDetails,
|
||||
} from "../../store/watchedCases/action";
|
||||
import {
|
||||
getBasicSearch,
|
||||
getBasicSearchDetails,
|
||||
getSearchDocumentDetails,
|
||||
getSearchDocumentHistory,
|
||||
getWatchedCases,
|
||||
getPortalModuleDetails,
|
||||
getToken,
|
||||
} from "../../actions";
|
||||
|
||||
const Home = (props) => {
|
||||
const { footerLinks, pages, watchedCases } = props;
|
||||
@@ -65,7 +50,7 @@ const Home = (props) => {
|
||||
<SearchResults
|
||||
searchString={props.search.searchString}
|
||||
searchResultsObj={props.searchResultsObj}
|
||||
myportal="true"
|
||||
myportal={true}
|
||||
watchedCases={watchedCases}
|
||||
/>
|
||||
</div>
|
||||
@@ -82,14 +67,11 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
||||
|
||||
const { cookies } = req;
|
||||
|
||||
let token = await getToken();
|
||||
token = token.access_token;
|
||||
|
||||
let loggedInUser = cookies.pinsUser;
|
||||
|
||||
let [searchResultsObj, watchedCases] = await Promise.all([
|
||||
await getBasicSearch(token, query.q),
|
||||
await getWatchedCases(token, loggedInUser),
|
||||
await getBasicSearch(query.q),
|
||||
await getWatchedCases(loggedInUser),
|
||||
]);
|
||||
|
||||
searchResultsObj =
|
||||
@@ -104,8 +86,8 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
||||
//console.log("sssss", searchResultsObj);
|
||||
|
||||
const [searchDetailsObj, watchedCasesDetails] = await Promise.all([
|
||||
await getSearchDetails(token, searchResultsObj),
|
||||
await getDetails(token, watchedCases, "myWatchedCases"),
|
||||
await getSearchDetails(searchResultsObj),
|
||||
await getDetails(watchedCases, "myWatchedCases"),
|
||||
]);
|
||||
|
||||
store.dispatch(setSearchResults(searchResultsObj));
|
||||
@@ -116,7 +98,7 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
||||
}
|
||||
);
|
||||
|
||||
const getDetails = (token, resultsObj, detailsType) => {
|
||||
const getDetails = (resultsObj, detailsType) => {
|
||||
//console.log(resultsObj);
|
||||
let detailsArr = [];
|
||||
resultsObj = resultsObj.value;
|
||||
@@ -132,7 +114,6 @@ const getDetails = (token, resultsObj, detailsType) => {
|
||||
} else {
|
||||
detailsArr.push(
|
||||
getPortalModuleDetails(
|
||||
token,
|
||||
getFormCollectionByID(searchDetail.pinswg_appealcasetype)
|
||||
.LogicalCollectionName,
|
||||
detailsType != "myWatchedCases"
|
||||
|
||||
@@ -1,25 +1,12 @@
|
||||
import _ from "lodash";
|
||||
import Head from "next/head";
|
||||
import Header from "../../components/header";
|
||||
import Banner from "../../components/banner";
|
||||
import CookieBanner from "../../components/cookieBanner";
|
||||
import Breadcrumbs from "../../components/breadcrumbs";
|
||||
import ViewAll from "../../components/myportal/viewall";
|
||||
import Footer from "../../components/footer";
|
||||
import Errorpage from "../../components/errorpage";
|
||||
import styles from "../../styles/Home.module.css";
|
||||
import { useSelector, shallowEqual, connect } from "react-redux";
|
||||
import { wrapper } from "../../store/store";
|
||||
|
||||
import { useRouter } from "next/router";
|
||||
import useTranslation from "next-translate/useTranslation";
|
||||
|
||||
import { setSearch, getSearchObj } from "../../store/search/action";
|
||||
import {
|
||||
setSearchResults,
|
||||
getSearchResultsObj,
|
||||
} from "../../store/searchOutput/action";
|
||||
import { getBasicSearch } from "../../actions";
|
||||
import Head from "next/head";
|
||||
import { useRouter } from "next/router";
|
||||
import { connect } from "react-redux";
|
||||
import Breadcrumbs from "../../components/breadcrumbs";
|
||||
import CookieBanner from "../../components/cookieBanner";
|
||||
import Footer from "../../components/footer";
|
||||
import Header from "../../components/header";
|
||||
import ViewAll from "../../components/myportal/viewall";
|
||||
|
||||
const Home = (props) => {
|
||||
const { footerLinks, pages } = props;
|
||||
@@ -52,7 +39,7 @@ const Home = (props) => {
|
||||
watchedCases={props.watchedCases}
|
||||
myRepresentations={props.myRepresentations}
|
||||
awaitingSubmission={props.awaitingSubmission}
|
||||
myportal="true"
|
||||
myportal={true}
|
||||
/>
|
||||
</div>
|
||||
<Footer footerLinks={footerLinks} />
|
||||
|
||||
@@ -1,49 +1,24 @@
|
||||
import _ from "lodash";
|
||||
import Head from "next/head";
|
||||
import Header from "../../components/header";
|
||||
import Banner from "../../components/banner";
|
||||
import CookieBanner from "../../components/cookieBanner";
|
||||
import Breadcrumbs from "../../components/breadcrumbs";
|
||||
import Footer from "../../components/footer";
|
||||
import Errorpage from "../../components/errorpage";
|
||||
import styles from "../../styles/Home.module.css";
|
||||
import { useSelector, shallowEqual, connect } from "react-redux";
|
||||
import { wrapper } from "../../store/store";
|
||||
|
||||
import { useRouter } from "next/router";
|
||||
import useTranslation from "next-translate/useTranslation";
|
||||
import jsonpath from "jsonpath";
|
||||
import useTranslation from "next-translate/useTranslation";
|
||||
import Head from "next/head";
|
||||
import { useRouter } from "next/router";
|
||||
import { useEffect } from "react";
|
||||
import {
|
||||
setLoggedInUserId,
|
||||
setAccountDetails,
|
||||
} from "../../store/accountDetails/action";
|
||||
import {
|
||||
setAppealType,
|
||||
setAppealTypeTitle,
|
||||
setAppealTypeID,
|
||||
getAppealTypeObj,
|
||||
setAppealLPA,
|
||||
setCaseReference,
|
||||
} from "../../store/appealType/action";
|
||||
import { setForm, getFormObj } from "../../store/formData/action";
|
||||
import {
|
||||
getToken,
|
||||
getFormData,
|
||||
getAppealsTypes,
|
||||
getMandatoryFields,
|
||||
createCase,
|
||||
getPickLists,
|
||||
updateCase,
|
||||
} from "../../actions";
|
||||
|
||||
import { connect } from "react-redux";
|
||||
import xpath from "xpath";
|
||||
import { reduxForm, FormName } from "redux-form";
|
||||
|
||||
import BuildSection from "../../components/newappeal/buildsection";
|
||||
import {
|
||||
createCase,
|
||||
getAppealsTypes,
|
||||
getFormData,
|
||||
getMandatoryFields,
|
||||
getPickLists,
|
||||
} from "../../actions";
|
||||
import Breadcrumbs from "../../components/breadcrumbs";
|
||||
import CookieBanner from "../../components/cookieBanner";
|
||||
import Footer from "../../components/footer";
|
||||
import Header from "../../components/header";
|
||||
import BuildCheckSection from "../../components/newappeal/buildchecksection";
|
||||
import BuildSection from "../../components/newappeal/buildsection";
|
||||
import CompleteAppeal from "../../components/newappeal/complete";
|
||||
|
||||
import AdvertsForm from "../../data/forms/adverts";
|
||||
import Callinss77Form from "../../data/forms/callinss77";
|
||||
import CommonLandForm from "../../data/forms/commonland";
|
||||
@@ -69,6 +44,16 @@ import PlanningObligationAppeals106Form from "../../data/forms/planningobligatio
|
||||
import RowForm from "../../data/forms/row";
|
||||
import TransportAndWorkActForm from "../../data/forms/transportandworkact";
|
||||
import WayleaveForm from "../../data/forms/wayleave";
|
||||
import { setLoggedInUserId } from "../../store/accountDetails/action";
|
||||
import {
|
||||
setAppealLPA,
|
||||
setAppealType,
|
||||
setAppealTypeID,
|
||||
setAppealTypeTitle,
|
||||
setCaseReference,
|
||||
} from "../../store/appealType/action";
|
||||
import { setForm } from "../../store/formData/action";
|
||||
import { wrapper } from "../../store/store";
|
||||
|
||||
let Home = (props) => {
|
||||
const { footerLinks, pages, formData } = props;
|
||||
@@ -331,8 +316,6 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
||||
console.log("the query", query);
|
||||
let loggedInUser = cookies.pinsUser;
|
||||
|
||||
let token = await getToken();
|
||||
token = token.access_token;
|
||||
const [
|
||||
caseReferenceData,
|
||||
appealTypeData,
|
||||
@@ -340,11 +323,11 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
||||
pickListData,
|
||||
formdata,
|
||||
] = await Promise.all([
|
||||
await createCase(token, query.apt, query.lpa, loggedInUser),
|
||||
await getAppealsTypes(token),
|
||||
await getMandatoryFields(token, query.appealtypes),
|
||||
await getPickLists(token, query.appealtypes),
|
||||
await getFormData(token, query.appealtypes),
|
||||
await createCase(query.apt, query.lpa, loggedInUser),
|
||||
await getAppealsTypes(),
|
||||
await getMandatoryFields(query.appealtypes),
|
||||
await getPickLists(query.appealtypes),
|
||||
await getFormData(query.appealtypes),
|
||||
]);
|
||||
|
||||
let caseReference = caseReferenceData;
|
||||
|
||||
+13
-41
@@ -1,42 +1,17 @@
|
||||
import Link from "next/link";
|
||||
import _ from "lodash";
|
||||
import Head from "next/head";
|
||||
import Header from "../../components/header";
|
||||
import Banner from "../../components/banner";
|
||||
import CookieBanner from "../../components/cookieBanner";
|
||||
import Breadcrumbs from "../../components/breadcrumbs";
|
||||
import Footer from "../../components/footer";
|
||||
import Errorpage from "../../components/errorpage";
|
||||
import styles from "../../styles/Home.module.css";
|
||||
import { useSelector, shallowEqual, connect } from "react-redux";
|
||||
import { wrapper } from "../../store/store";
|
||||
import { useRouter } from "next/router";
|
||||
import { useEffect, useState } from "react";
|
||||
import useTranslation from "next-translate/useTranslation";
|
||||
import jsonpath from "jsonpath";
|
||||
import { reduxForm, formValueSelector } from "redux-form";
|
||||
|
||||
import Head from "next/head";
|
||||
import { useRouter } from "next/router";
|
||||
import { connect } from "react-redux";
|
||||
import { getAppealsTypes, getLPA } from "../../actions";
|
||||
import Breadcrumbs from "../../components/breadcrumbs";
|
||||
import CookieBanner from "../../components/cookieBanner";
|
||||
import Footer from "../../components/footer";
|
||||
import Header from "../../components/header";
|
||||
import CreateCase from "../../components/newappeal/createCase";
|
||||
import xpath from "xpath";
|
||||
import {
|
||||
setLoggedInUserId,
|
||||
setAccountDetails,
|
||||
} from "../../store/accountDetails/action";
|
||||
import {
|
||||
setAppealType,
|
||||
setAppealTypeTitle,
|
||||
setAppealTypeID,
|
||||
setAppealLPA,
|
||||
getAppealTypeObj,
|
||||
} from "../../store/appealType/action";
|
||||
import {
|
||||
getAppealsTypes,
|
||||
getLPA,
|
||||
updateCase,
|
||||
createCase,
|
||||
getToken,
|
||||
} from "../../actions";
|
||||
import { setLoggedInUserId } from "../../store/accountDetails/action";
|
||||
import { setAppealType } from "../../store/appealType/action";
|
||||
import { setLPA } from "../../store/lpa/action";
|
||||
import { wrapper } from "../../store/store";
|
||||
|
||||
const Home = (props) => {
|
||||
const { footerLinks, pages, formData } = props;
|
||||
@@ -150,12 +125,9 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
||||
|
||||
let loggedInUser = cookies.pinsUser;
|
||||
|
||||
let token = await getToken();
|
||||
token = token.access_token;
|
||||
|
||||
const [appealTypeData, lpaData, caseData] = await Promise.all([
|
||||
await getAppealsTypes(token),
|
||||
await getLPA(token),
|
||||
await getAppealsTypes(),
|
||||
await getLPA(),
|
||||
]);
|
||||
|
||||
store.dispatch(setAppealType(appealTypeData));
|
||||
|
||||
@@ -1,18 +1,10 @@
|
||||
import _ from "lodash";
|
||||
import Head from "next/head";
|
||||
import Header from "../../components/header";
|
||||
import Banner from "../../components/banner";
|
||||
import CookieBanner from "../../components/cookieBanner";
|
||||
import Breadcrumbs from "../../components/breadcrumbs";
|
||||
import NewAppeal from "../../components/newappeal";
|
||||
import Footer from "../../components/footer";
|
||||
import Errorpage from "../../components/errorpage";
|
||||
import styles from "../../styles/Home.module.css";
|
||||
import { useSelector, shallowEqual, connect } from "react-redux";
|
||||
import { wrapper } from "../../store/store";
|
||||
|
||||
import { useRouter } from "next/router";
|
||||
import useTranslation from "next-translate/useTranslation";
|
||||
import Head from "next/head";
|
||||
import { useRouter } from "next/router";
|
||||
import CookieBanner from "../../components/cookieBanner";
|
||||
import Footer from "../../components/footer";
|
||||
import Header from "../../components/header";
|
||||
import NewAppeal from "../../components/newappeal";
|
||||
|
||||
const Home = (props) => {
|
||||
const { footerLinks, pages } = props;
|
||||
@@ -40,39 +32,4 @@ const Home = (props) => {
|
||||
);
|
||||
};
|
||||
|
||||
// export const getServerSideProps = wrapper.getServerSideProps(
|
||||
// async ({ locale, store, req, res }) => {
|
||||
// let token = await getToken()
|
||||
// token = token.access_token;
|
||||
// let accessToken = token.access_token;
|
||||
|
||||
// const apiRoot = process.browser ? window.API_ROOT : process.env.API_ROOT;
|
||||
|
||||
// const [pages, footerLinks, courseListContent] = await Promise.all([
|
||||
// await getPages(accessToken, locale),
|
||||
// await getFooterLinks(accessToken, locale),
|
||||
// await getCourseList(accessToken, locale),
|
||||
// ]);
|
||||
// //const courseID = await getCourseID
|
||||
// store.dispatch(setApiRoot(apiRoot));
|
||||
// store.dispatch(setPages(pages));
|
||||
// store.dispatch(setFooterLinks(footerLinks));
|
||||
// store.dispatch(setCourseListContent(courseListContent));
|
||||
// }
|
||||
// );
|
||||
|
||||
// const mapStateToProps = (state) => {
|
||||
// //console.log(state);
|
||||
|
||||
// return {
|
||||
// apiroot: state.apiroot,
|
||||
// courseListContent: state.courseListContent.courseListContent,
|
||||
// pages: state.pages.pages,
|
||||
// footerLinks: state.footerLinks.footerLinks,
|
||||
// regions: state.regions,
|
||||
// sectors: state.sectors,
|
||||
// form: state.form,
|
||||
// };
|
||||
// };
|
||||
|
||||
export default Home; //connect(mapStateToProps)(Home);
|
||||
|
||||
@@ -1,27 +1,19 @@
|
||||
import _ from "lodash";
|
||||
import useTranslation from "next-translate/useTranslation";
|
||||
import Head from "next/head";
|
||||
import Header from "../../components/header";
|
||||
import Banner from "../../components/banner";
|
||||
import CookieBanner from "../../components/cookieBanner";
|
||||
import Breadcrumbs from "../../components/breadcrumbs";
|
||||
import Footer from "../../components/footer";
|
||||
import Errorpage from "../../components/errorpage";
|
||||
import styles from "../../styles/Home.module.css";
|
||||
import { useSelector, shallowEqual, connect } from "react-redux";
|
||||
import { wrapper } from "../../store/store";
|
||||
|
||||
import { useRouter } from "next/router";
|
||||
import { useState } from "react";
|
||||
import useTranslation from "next-translate/useTranslation";
|
||||
|
||||
import { connect } from "react-redux";
|
||||
import { getAppealsTypes } from "../../actions";
|
||||
import Breadcrumbs from "../../components/breadcrumbs";
|
||||
import CookieBanner from "../../components/cookieBanner";
|
||||
import Footer from "../../components/footer";
|
||||
import Header from "../../components/header";
|
||||
import {
|
||||
setAppealType,
|
||||
setAppealTypeTitle,
|
||||
setAppealTypeID,
|
||||
getAppealTypeObj,
|
||||
setAppealTypeTitle,
|
||||
} from "../../store/appealType/action";
|
||||
import { getAppealsTypes } from "../../actions";
|
||||
import xpath from "xpath";
|
||||
import { wrapper } from "../../store/store";
|
||||
|
||||
const Home = (props) => {
|
||||
const { footerLinks, pages, formData } = props;
|
||||
|
||||
+7
-16
@@ -1,21 +1,12 @@
|
||||
import _ from "lodash";
|
||||
import { useState, useEffect, useRef } from "react";
|
||||
import Head from "next/head";
|
||||
import Header from "../components/header";
|
||||
import ServiceBanner from "../components/servicebanner";
|
||||
import CookieBanner from "../components/cookieBanner";
|
||||
import Breadcrumbs from "../components/breadcrumbs";
|
||||
import Main from "../components/main";
|
||||
import Footer from "../components/footer";
|
||||
import Errorpage from "../components/errorpage";
|
||||
import styles from "../styles/Home.module.css";
|
||||
import { useSelector, shallowEqual, connect } from "react-redux";
|
||||
import { wrapper } from "../store/store";
|
||||
import { useRouter } from "next/router";
|
||||
import useTranslation from "next-translate/useTranslation";
|
||||
import { getIncidents } from "../actions";
|
||||
import { parseCookies } from "nookies";
|
||||
import Head from "next/head";
|
||||
import { useRouter } from "next/router";
|
||||
import Breadcrumbs from "../components/breadcrumbs";
|
||||
import CookieBanner from "../components/cookieBanner";
|
||||
import Footer from "../components/footer";
|
||||
import Header from "../components/header";
|
||||
import PrivacyStatement from "../components/privacy";
|
||||
import ServiceBanner from "../components/servicebanner";
|
||||
|
||||
const Privacy = (props) => {
|
||||
const { footerLinks, pages, showLogin } = props;
|
||||
|
||||
+35
-49
@@ -1,43 +1,39 @@
|
||||
import _ from "lodash";
|
||||
import Head from "next/head";
|
||||
import Header from "../components/header";
|
||||
import Banner from "../components/banner";
|
||||
import CookieBanner from "../components/cookieBanner";
|
||||
import Breadcrumbs from "../components/breadcrumbs";
|
||||
import SearchResults from "../components/searchresults";
|
||||
import Footer from "../components/footer";
|
||||
import Errorpage from "../components/errorpage";
|
||||
import styles from "../styles/Home.module.css";
|
||||
import { useSelector, shallowEqual, connect } from "react-redux";
|
||||
import { wrapper } from "../store/store";
|
||||
import { useRouter } from "next/router";
|
||||
import useTranslation from "next-translate/useTranslation";
|
||||
import jsonpath from "jsonpath";
|
||||
import data from "../data/collections.json";
|
||||
|
||||
import { setSearch, getSearchObj } from "../store/search/action";
|
||||
import {
|
||||
setSearchResults,
|
||||
setSearchDetails,
|
||||
getSearchResultsObj,
|
||||
} from "../store/searchOutput/action";
|
||||
import { getBasicSearch, getBasicSearchDetails, getToken } from "../actions";
|
||||
import Head from "next/head";
|
||||
import { useRouter } from "next/router";
|
||||
import { connect } from "react-redux";
|
||||
import { getBasicSearch } from "../actions";
|
||||
import Breadcrumbs from "../components/breadcrumbs";
|
||||
import CookieBanner from "../components/cookieBanner";
|
||||
import Footer from "../components/footer";
|
||||
import Header from "../components/header";
|
||||
import SearchResults from "../components/searchresults";
|
||||
import { getSearchDetails } from "../components/utils";
|
||||
import { setSearch } from "../store/search/action";
|
||||
import {
|
||||
setSearchDetails,
|
||||
setSearchResults,
|
||||
} from "../store/searchOutput/action";
|
||||
import { wrapper } from "../store/store";
|
||||
|
||||
const Home = (props) => {
|
||||
const { footerLinks, pages } = props;
|
||||
const { footerLinks, pages, isLinkedCase } = props;
|
||||
let { t, lang } = useTranslation();
|
||||
|
||||
const router = useRouter();
|
||||
const { locale } = router;
|
||||
const { appealtypes } = router.query;
|
||||
|
||||
const pageTitle = isLinkedCase
|
||||
? t("search:searchresults-title-label-linked-case") +
|
||||
" - " +
|
||||
t("common:service-name")
|
||||
: t("search:page-title") + " - " + t("common:service-name");
|
||||
|
||||
return (
|
||||
<div>
|
||||
<Head>
|
||||
<title>
|
||||
{t("search:page-title")} - {t("common:service-name")}
|
||||
</title>
|
||||
<title>{pageTitle}</title>
|
||||
<>
|
||||
<link
|
||||
rel="canonical"
|
||||
@@ -108,6 +104,7 @@ const Home = (props) => {
|
||||
<SearchResults
|
||||
searchString={props.search.searchString}
|
||||
searchResultsObj={props.searchResultsObj}
|
||||
isLinkedCase={isLinkedCase}
|
||||
/>
|
||||
</div>
|
||||
<Footer footerLinks={footerLinks} />
|
||||
@@ -121,26 +118,14 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
||||
async ({ query, req, res }) => {
|
||||
console.log("query-", query);
|
||||
|
||||
let token = await getToken();
|
||||
let isLinked =
|
||||
typeof query.lk != "undefined" && query.lk == "1"
|
||||
? true
|
||||
: false;
|
||||
|
||||
var tokenIssuedAt = new Date();
|
||||
var tokenExpiryTimeAt = new Date();
|
||||
tokenExpiryTimeAt.setSeconds(
|
||||
tokenExpiryTimeAt.getSeconds() + token.expires_in
|
||||
);
|
||||
//console.log("is linked:", isLinked);
|
||||
|
||||
console.log(
|
||||
"token issued:",
|
||||
tokenIssuedAt.toUTCString(),
|
||||
"\n",
|
||||
"token expires:",
|
||||
tokenExpiryTimeAt.toUTCString()
|
||||
);
|
||||
console.log(token);
|
||||
|
||||
token = token.access_token;
|
||||
|
||||
let searchResultsObj = await getBasicSearch(token, query.q);
|
||||
let searchResultsObj = await getBasicSearch(query.q);
|
||||
|
||||
searchResultsObj =
|
||||
searchResultsObj.status == 502
|
||||
@@ -153,14 +138,15 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
||||
|
||||
//console.log("sssss", searchResultsObj);
|
||||
|
||||
const searchDetailsObj = await getSearchDetails(
|
||||
token,
|
||||
searchResultsObj
|
||||
);
|
||||
const searchDetailsObj = await getSearchDetails(searchResultsObj);
|
||||
|
||||
store.dispatch(setSearchResults(searchResultsObj));
|
||||
store.dispatch(setSearchDetails(searchDetailsObj));
|
||||
store.dispatch(setSearch(query.q));
|
||||
|
||||
return {
|
||||
props: { isLinkedCase: isLinked },
|
||||
};
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
@@ -1,20 +1,11 @@
|
||||
import _ from "lodash";
|
||||
import { useState, useEffect, useRef } from "react";
|
||||
import useTranslation from "next-translate/useTranslation";
|
||||
import Head from "next/head";
|
||||
import { useRouter } from "next/router";
|
||||
import Breadcrumbs from "../components/breadcrumbs";
|
||||
import CookieBanner from "../components/cookieBanner";
|
||||
import Footer from "../components/footer";
|
||||
import Header from "../components/header";
|
||||
import ServiceBanner from "../components/servicebanner";
|
||||
import CookieBanner from "../components/cookieBanner";
|
||||
import Breadcrumbs from "../components/breadcrumbs";
|
||||
import Main from "../components/main";
|
||||
import Footer from "../components/footer";
|
||||
import Errorpage from "../components/errorpage";
|
||||
import styles from "../styles/Home.module.css";
|
||||
import { useSelector, shallowEqual, connect } from "react-redux";
|
||||
import { wrapper } from "../store/store";
|
||||
import { useRouter } from "next/router";
|
||||
import useTranslation from "next-translate/useTranslation";
|
||||
import { getIncidents } from "../actions";
|
||||
import { parseCookies } from "nookies";
|
||||
import TermsAndConditionsStatement from "../components/tandc";
|
||||
|
||||
const TandC = (props) => {
|
||||
|
||||
+11
-20
@@ -1,25 +1,16 @@
|
||||
import _ from "lodash";
|
||||
import Head from "next/head";
|
||||
import Header from "../components/header";
|
||||
import Banner from "../components/banner";
|
||||
import CookieBanner from "../components/cookieBanner";
|
||||
import Breadcrumbs from "../components/breadcrumbs";
|
||||
import ViewAll from "../components/viewall";
|
||||
import Footer from "../components/footer";
|
||||
import Errorpage from "../components/errorpage";
|
||||
import styles from "../styles/Home.module.css";
|
||||
import { useSelector, shallowEqual, connect } from "react-redux";
|
||||
import { wrapper } from "../store/store";
|
||||
|
||||
import { useRouter } from "next/router";
|
||||
import useTranslation from "next-translate/useTranslation";
|
||||
|
||||
import { setSearch, getSearchObj } from "../store/search/action";
|
||||
import {
|
||||
setSearchResults,
|
||||
getSearchResultsObj,
|
||||
} from "../store/searchOutput/action";
|
||||
import Head from "next/head";
|
||||
import { useRouter } from "next/router";
|
||||
import { connect } from "react-redux";
|
||||
import { getBasicSearch } from "../actions";
|
||||
import Breadcrumbs from "../components/breadcrumbs";
|
||||
import CookieBanner from "../components/cookieBanner";
|
||||
import Footer from "../components/footer";
|
||||
import Header from "../components/header";
|
||||
import ViewAll from "../components/viewall";
|
||||
import { setSearch } from "../store/search/action";
|
||||
import { setSearchResults } from "../store/searchOutput/action";
|
||||
import { wrapper } from "../store/store";
|
||||
|
||||
const Home = (props) => {
|
||||
const { footerLinks, pages } = props;
|
||||
|
||||
Reference in New Issue
Block a user