121 lines
4.1 KiB
JavaScript
121 lines
4.1 KiB
JavaScript
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 { 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 { JSONPath as jsonpath } from "jsonpath-plus";
|
|
import { reduxForm, formValueSelector } from "redux-form";
|
|
|
|
import ChangePassword from "../../components/account/changepassword";
|
|
import xpath from "xpath";
|
|
import {
|
|
setAppealType,
|
|
setAppealTypeTitle,
|
|
setAppealTypeID,
|
|
setAppealLPA,
|
|
getAppealTypeObj
|
|
} from "../../store/appealType/action";
|
|
import {
|
|
getAppealsTypes,
|
|
getLPA
|
|
} from "../../actions/services/referenceDataService";
|
|
import { setLPA } from "../../store/lpa/action";
|
|
|
|
import { getSession, useSession } from "next-auth/react";
|
|
import NoSessionWarning from "../../components/nosession";
|
|
|
|
const Home = (props) => {
|
|
const { footerLinks, pages, formData } = props;
|
|
let { t, lang } = useTranslation();
|
|
|
|
const router = useRouter();
|
|
const { locale } = router;
|
|
const { appealtypes } = router.query;
|
|
|
|
const { appealType, LPAData } = props;
|
|
const [passwordUpdated, setPasswordUpdated] = useState(false);
|
|
|
|
const { data: session, status } = useSession();
|
|
|
|
if (status === "loading") {
|
|
return <NoSessionWarning loading={true} />;
|
|
}
|
|
|
|
if (status === "unauthenticated") {
|
|
router.push("/auth/signin");
|
|
return <NoSessionWarning />;
|
|
}
|
|
|
|
return (
|
|
<div>
|
|
<Head>
|
|
<title>
|
|
{t("search:page-title")} - {t("common:service-name")}
|
|
</title>
|
|
</Head>
|
|
<div id="page_wrapper">
|
|
<CookieBanner />
|
|
<Header />
|
|
|
|
<div className="govuk-grid-row">
|
|
<div className="govuk-grid-column-full">
|
|
<div className="govuk-width-container">
|
|
<Breadcrumbs slug={appealtypes} props={props} />
|
|
<main
|
|
className="govuk-main-wrapper--auto-spacing"
|
|
id="main-content"
|
|
role="main"
|
|
>
|
|
<div className="govuk-grid-row">
|
|
<div className="govuk-grid-column-two-thirds">
|
|
{passwordUpdated == true ? (
|
|
<h1>
|
|
Your password has been changed
|
|
</h1>
|
|
) : (
|
|
<h1>Change password</h1>
|
|
)}
|
|
<ChangePassword
|
|
props={props}
|
|
setPasswordUpdated={
|
|
setPasswordUpdated
|
|
}
|
|
passwordUpdated={passwordUpdated}
|
|
/>
|
|
</div>
|
|
</div>
|
|
</main>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<Footer footerLinks={footerLinks} ticketnumber={props} />
|
|
</div>
|
|
</div>
|
|
);
|
|
};
|
|
|
|
const mapStateToProps = (state) => {
|
|
return {
|
|
search: state.search,
|
|
searchResultsObj: state.searchResultsObj,
|
|
formData: state.formData,
|
|
appealType: state.appealType,
|
|
LPAData: state.LPAData,
|
|
form: state.form,
|
|
accountDetails: state.accountDetails
|
|
};
|
|
};
|
|
|
|
export default connect(mapStateToProps)(Home);
|