updated breadcrumb link on case details page
This commit is contained in:
+50
-17
@@ -12,7 +12,10 @@ import {
|
||||
import CookieBanner from "../../../components/cookieBanner";
|
||||
import Footer from "../../../components/footer";
|
||||
import Header from "../../../components/header";
|
||||
import { getSearchDetails } from "../../../components/utils";
|
||||
import {
|
||||
getSearchDetails,
|
||||
getFormCollectionByID,
|
||||
} from "../../../components/utils";
|
||||
import { setCurrentReference } from "../../../store/currentView/action";
|
||||
import { setSearch } from "../../../store/search/action";
|
||||
import {
|
||||
@@ -144,29 +147,61 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
||||
// "\n======================================\n"
|
||||
// );
|
||||
|
||||
store.dispatch(setSearch(req.headers.referer.split("?")[1]));
|
||||
var whichAppeal = getFormCollectionByID(
|
||||
searchResultsObj.value[0].pinswg_appealcasetype
|
||||
).LogicalName;
|
||||
|
||||
console.log(
|
||||
searchResultsObj["@odata.count"] > 1 ||
|
||||
searchResultsObj["@odata.count"] < 1
|
||||
var defaultPostcode =
|
||||
whichAppeal == "pinswg_ldps" ||
|
||||
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 {
|
||||
redirect: {
|
||||
destination: "/404",
|
||||
permanent: false,
|
||||
},
|
||||
};
|
||||
} else {
|
||||
if (searchResultsObj["@odata.count"] > 1) {
|
||||
return {
|
||||
redirect: {
|
||||
//destination: "/dns-not-found",
|
||||
destination: "/404",
|
||||
permanent: false,
|
||||
},
|
||||
};
|
||||
} else {
|
||||
store.dispatch(
|
||||
setCurrentReference({
|
||||
@@ -179,8 +214,6 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
||||
// console.log(searchResultsObj);
|
||||
return {
|
||||
props: {
|
||||
searchResultsObj: {
|
||||
|
||||
Reference in New Issue
Block a user