Merge from git

This commit is contained in:
2021-11-01 11:21:39 +00:00
parent adcff32d73
commit d94b3b3e5a
210 changed files with 69742 additions and 3359 deletions
+95 -19
View File
@@ -10,15 +10,18 @@ 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 Cookies from "cookies";
import { useRouter } from "next/router";
import { useState } from "react";
import { useEffect, useState } from "react";
import useTranslation from "next-translate/useTranslation";
import jsonpath from "jsonpath";
import { reduxForm, formValueSelector } from "redux-form";
import CreateCase from "../../components/newappeal/createCase";
import xpath from "xpath";
import {
setLoggedInUserId,
setAccountDetails,
} from "../../store/accountDetails/action";
import {
setAppealType,
setAppealTypeTitle,
@@ -26,7 +29,13 @@ import {
setAppealLPA,
getAppealTypeObj,
} from "../../store/appealType/action";
import { getAppealsTypes, getLPA } from "../../actions";
import {
getAppealsTypes,
getLPA,
updateCase,
createCase,
getSASToken,
} from "../../actions";
import { setLPA } from "../../store/lpa/action";
const Home = (props) => {
@@ -43,22 +52,82 @@ const Home = (props) => {
<div>
<Head>
<title>
{t("search:page-title")} - {t("common:service-name")}
{t("newappeal:page-title")} - {t("common:service-name")}
</title>
<>
<link
rel="canonical"
href={t("common:gov-wales-link") + router.asPath}
/>
<meta
key="og:locale"
property="og:locale"
content={router.locale}
/>
{/* If they have a Twitter Handle, include the meta details below */}
<meta
key="og:site_name"
property="og:site_name"
content={t("common:service-name")}
/>
<meta
key="twitter:site"
property="twitter:site"
content="@UKGovWales"
/>
<meta
name="description"
content={t("common:service-description")}
/>
<meta
property="og:site_name"
content={t("common:gov-wales-label")}
/>
<meta
property="og:title"
content={t("newappeal:page-title")}
/>
<meta
property="og:description"
content={t("common:service-description")}
/>
<meta property="og:type" content="website" />
<meta
property="og:url"
content={t("common:gov-wales-link")}
/>
<meta
property="og:image"
content="https://gov.wales/themes/custom/govwales/images/content/og-global-1200.png"
/>
<meta name="twitter:card" content="summary" />
<meta
name="twitter:title"
content={t("common:gov-wales-label")}
/>
<meta
name="twitter:url"
content={t("common:gov-wales-link") + router.asPath}
/>
<meta
name="twitter:image"
content="https://gov.wales/themes/custom/govwales/images/content/og-global-120.png"
/>
</>
</Head>
<div id="page_wrapper">
<CookieBanner />
<Header courseName={t("common:service-name")} />
<div className="govuk-width-container">
<Banner />
<Breadcrumbs slug={appealtypes} />
<main
className="govuk-main-wrapper--auto-spacing"
id="main-content"
role="main"
>
<h1>New Appeal</h1>
<h1>{t("newappeal:page-title")}</h1>
<CreateCase
LPAData={props.LPAData}
appealType={props.setAppealType}
@@ -73,19 +142,25 @@ const Home = (props) => {
};
export const getServerSideProps = wrapper.getServerSideProps(
(store) =>
async ({ query, req, res }) => {
res.setHeader(
"Cache-Control",
"public, s-maxage=604800, stale-while-revalidate"
);
const [appealTypeData, lpaData] = await Promise.all([
await getAppealsTypes(),
await getLPA(),
]);
store.dispatch(setAppealType(appealTypeData));
store.dispatch(setLPA(lpaData));
}
(store) => async (ctx) => {
const { req, res } = ctx;
const { cookies } = req;
console.log(cookies);
let loggedInUser = cookies.pinsUser;
const token = await getSASToken();
const [appealTypeData, lpaData, caseData] = await Promise.all([
await getAppealsTypes(token),
await getLPA(token),
]);
store.dispatch(setAppealType(appealTypeData));
store.dispatch(setLPA(lpaData));
store.dispatch(setLoggedInUserId(loggedInUser));
}
);
const mapStateToProps = (state) => {
@@ -96,6 +171,7 @@ const mapStateToProps = (state) => {
appealType: state.appealType,
LPAData: state.LPAData,
form: state.form,
accountDetails: state.accountDetails,
};
};