import useTranslation from "next-translate/useTranslation"; import Head from "next/head"; import { useRouter } from "next/router"; import { connect } from "react-redux"; import { getIP } from "../actions/core/logger"; import { getBasicSearch } from "../actions/services/searchService"; import Breadcrumbs from "../components/breadcrumbs"; import CookieBanner from "../components/cookieBanner"; import Footer from "../components/footer"; import Header from "../components/header"; import SearchResults from "../components/searchresults"; import { getSearchDetails } from "../components/utils"; import { setShowReps } from "../store/currentView/action"; import { setSearch } from "../store/search/action"; import { setSearchDetails, setSearchResults } from "../store/searchOutput/action"; import { wrapper } from "../store/store"; import ServiceBanner from "../components/servicebanner"; const Home = (props) => { const { footerLinks, pages, isLinkedCase, showLoginCheck } = props; let { t, lang } = useTranslation(); const router = useRouter(); const { locale } = router; const { appealtypes } = router.query; const pageTitle = isLinkedCase ? t("search:searchresults-title-label-linked-case") + " - " + t("common:service-name") : t("search:page-title") + " - " + t("common:service-name"); return (
{pageTitle} <> {/* If they have a Twitter Handle, include the meta details below */}
); }; export const getServerSideProps = wrapper.getServerSideProps( (store) => async (ctx) => { const { query, req, res } = ctx; getIP(req); console.log("query-", query); let isLinked = typeof query.lk != "undefined" && query.lk == "1" ? true : false; //console.log("is linked:", isLinked); const showLoginCheck = process.env.SHOWLOGIN || false; const showReps = process.env.SHOWREPRESENTATIONS || false; store.dispatch(setShowReps(showReps, showLoginCheck)); store.dispatch(setSearch(query?.q || "")); return { props: { isLinkedCase: isLinked, showLoginCheck: showLoginCheck } }; } // } // } ); const mapStateToProps = (state) => { return { currentView: state.currentView, search: state.search, searchResultsObj: state.searchResultsObj, formData: state.formData, appealType: state.appealType, form: state.form, myCases: state.myCases, watchedCases: state.watchedCases, myRepresentations: state.myRepresentations, awaitingSubmission: state.awaitingSubmission }; }; export default connect(mapStateToProps)(Home);