added error handling for relay down

This commit is contained in:
2021-09-30 10:19:41 +01:00
parent 7b741b656f
commit 066612adbd
4 changed files with 50 additions and 16 deletions
+17 -5
View File
@@ -14,6 +14,7 @@ import { wrapper } from "../store/store";
import Cookies from "cookies";
import { useRouter } from "next/router";
import useTranslation from "next-translate/useTranslation";
import CRMError from "../components/crmError";
import {
setAppealType,
@@ -39,6 +40,13 @@ 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")
? true
: false;
return (
<div>
<Head>
@@ -52,10 +60,14 @@ const Home = (props) => {
<div className="govuk-width-container">
<Banner />
<Breadcrumbs slug={appealtypes} />
<Search
lpadata={props.LPAData}
appealType={props.appealType}
/>
{hasError ? (
<CRMError props={props} whichError="advancedSearch" />
) : (
<Search
lpadata={props.LPAData}
appealType={props.appealType}
/>
)}
</div>
<Footer footerLinks={footerLinks} />
</div>
@@ -68,7 +80,7 @@ export const getServerSideProps = wrapper.getServerSideProps(
async ({ query, req, res }) => {
const token = await getSASToken();
const [appealTypeData, lpaData, caseData] = await Promise.all([
const [appealTypeData, lpaData] = await Promise.all([
await getAppealsTypes(token),
await getLPA(token),
]);