Merged PR 1126: updated breadcrumb link on case details page

updated breadcrumb link on case details page

Related work items: #10914
This commit is contained in:
Robert Bond
2024-04-22 16:52:50 +00:00
+50 -17
View File
@@ -12,7 +12,10 @@ import {
import CookieBanner from "../../../components/cookieBanner"; import CookieBanner from "../../../components/cookieBanner";
import Footer from "../../../components/footer"; import Footer from "../../../components/footer";
import Header from "../../../components/header"; import Header from "../../../components/header";
import { getSearchDetails } from "../../../components/utils"; import {
getSearchDetails,
getFormCollectionByID,
} from "../../../components/utils";
import { setCurrentReference } from "../../../store/currentView/action"; import { setCurrentReference } from "../../../store/currentView/action";
import { setSearch } from "../../../store/search/action"; import { setSearch } from "../../../store/search/action";
import { import {
@@ -144,29 +147,61 @@ export const getServerSideProps = wrapper.getServerSideProps(
// "\n======================================\n" // "\n======================================\n"
// ); // );
store.dispatch(setSearch(req.headers.referer.split("?")[1])); var whichAppeal = getFormCollectionByID(
searchResultsObj.value[0].pinswg_appealcasetype
).LogicalName;
console.log( var defaultPostcode =
searchResultsObj["@odata.count"] > 1 || whichAppeal == "pinswg_ldps" ||
searchResultsObj["@odata.count"] < 1 whichAppeal == "pinswg_harbourrevisionorders"
? "pinswg_postcode"
: whichAppeal == "pinswg_transportandworkacts" ||
whichAppeal == "pinswg_electricityacts" ||
whichAppeal == "pinswg_dnses"
? "pinswg_postcode"
: "pinswg_siteaddresspostcode";
var defaultFirstLineAddress =
whichAppeal == "pinswg_ldps" ||
whichAppeal == "pinswg_harbourrevisionorders"
? "pinswg_postcode"
: whichAppeal == "pinswg_transportandworkacts" ||
whichAppeal == "pinswg_electricityacts" ||
whichAppeal == "pinswg_dnses"
? "pinswg_addressline1"
: "pinswg_siteaddressline1";
store.dispatch(
req.headers.hasOwnProperty("referer")
? req.headers.referer.indexOf("?") > -1
? setSearch(req.headers.referer.split("?")[1])
: setSearch(
searchDetailsObj[0].value[0][defaultPostcode] == null
? "postcode=" +
searchDetailsObj[0].value[0][
defaultPostcode
]
: "addressline1=" +
searchDetailsObj[0].value[0][
defaultFirstLineAddress
]
)
: setSearch(
"postcode=" +
searchDetailsObj[0].value[0][defaultPostcode]
)
); );
if (searchResultsObj["@odata.count"] < 1) { if (
searchResultsObj["@odata.count"] < 1 ||
searchResultsObj["@odata.count"] > 1
) {
return { return {
redirect: { redirect: {
destination: "/404", destination: "/404",
permanent: false, permanent: false,
}, },
}; };
} else {
if (searchResultsObj["@odata.count"] > 1) {
return {
redirect: {
//destination: "/dns-not-found",
destination: "/404",
permanent: false,
},
};
} else { } else {
store.dispatch( store.dispatch(
setCurrentReference({ setCurrentReference({
@@ -179,8 +214,6 @@ export const getServerSideProps = wrapper.getServerSideProps(
}) })
); );
} }
}
// console.log(searchResultsObj);
return { return {
props: { props: {
searchResultsObj: { searchResultsObj: {