import _ from "lodash"; import Head from "next/head"; import Header from "../../components/header"; import Banner from "../../components/banner"; import CookieBanner from "../../components/cookieBanner"; import Breadcrumbs from "../../components/breadcrumbs"; import MyPortal from "../../components/myportal"; import Footer from "../../components/footer"; import Errorpage from "../../components/errorpage"; import styles from "../../styles/Home.module.css"; import { useSelector, shallowEqual, connect } from "react-redux"; import { wrapper } from "../../store/store"; import Cookies from "cookies"; import { useRouter } from "next/router"; import useTranslation from "next-translate/useTranslation"; import { setMyCases } from "../../store/myCases/action"; import { setMyRepresentations } from "../../store/myRepresentations/action"; import { setWatchedCases } from "../../store/watchedCases/action"; import { setAwaitingSubmission } from "../../store/awaitingSubmission/action"; import { getMyCases, getMyRepresentations, getWatchedCases, getAwaitingSubmission, } from "../../actions"; const Home = (props) => { const { footerLinks, pages, myCases, myRepresentations, watchedCases, awaitingSubmission, } = props; let { t, lang } = useTranslation(); const router = useRouter(); const { locale } = router; const { appealtypes } = router.query; return (
{t("myportal:page-title")} - {t("common:service-name")}
); }; export const getServerSideProps = wrapper.getServerSideProps( (store) => async ({ query, req, res }) => { //console.log("the query", query); res.setHeader( "Cache-Control", "public, s-maxage=604800, stale-while-revalidate" ); const [ myCases, myRepresentations, watchedCases, awaitingSubmission, ] = await Promise.all([ await getMyCases(), await getMyRepresentations(), await getWatchedCases(), await getAwaitingSubmission(), ]); store.dispatch(setMyCases(myCases)); store.dispatch(setMyRepresentations(myRepresentations)); store.dispatch(setWatchedCases(watchedCases)); store.dispatch(setAwaitingSubmission(awaitingSubmission)); } ); const mapStateToProps = (state) => { //console.log(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);