added error handling for relay down
This commit is contained in:
+17
-5
@@ -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),
|
||||
]);
|
||||
|
||||
Reference in New Issue
Block a user