information banner from api with date range
This commit is contained in:
@@ -3,7 +3,7 @@ import useTranslation from "next-translate/useTranslation";
|
||||
import Head from "next/head";
|
||||
import { useRouter } from "next/router";
|
||||
import { connect } from "react-redux";
|
||||
import { getAppealsTypes, getLPA } from "../../actions";
|
||||
import { getAppealsTypes, getLPA, getPersonalAccount } from "../../actions";
|
||||
import { getProviderConfig } from "../../actions/govgateway";
|
||||
import Breadcrumbs from "../../components/breadcrumbs";
|
||||
import CookieBanner from "../../components/cookieBanner";
|
||||
@@ -16,6 +16,12 @@ import { setAppealType } from "../../store/appealType/action";
|
||||
import { getGovGatewayConfig } from "../../store/govgateway/action";
|
||||
import { setLPA } from "../../store/lpa/action";
|
||||
import { wrapper } from "../../store/store";
|
||||
import { getSession, useSession } from "next-auth/react";
|
||||
import {
|
||||
setAccountDetails,
|
||||
setContainerID,
|
||||
setLoggedInUserId,
|
||||
} from "../../store/accountDetails/action";
|
||||
|
||||
const Home = (props) => {
|
||||
const { footerLinks, pages } = props;
|
||||
@@ -61,21 +67,32 @@ const Home = (props) => {
|
||||
};
|
||||
|
||||
export const getServerSideProps = wrapper.getServerSideProps(
|
||||
(store) =>
|
||||
async ({ query, req, res }) => {
|
||||
const [appealTypeData, lpaData] = await Promise.all([
|
||||
await getAppealsTypes(),
|
||||
await getLPA(),
|
||||
]);
|
||||
const providerConfig = await getProviderConfig();
|
||||
store.dispatch(getGovGatewayConfig(providerConfig));
|
||||
(store) => async (ctx) => {
|
||||
const { query, req, res } = ctx;
|
||||
console.log("query-", query);
|
||||
|
||||
// const lpaData = require("../../data/lpa.json");
|
||||
// const appealTypeData = require("../../data/appealtypes.json");
|
||||
const { cookies } = req;
|
||||
|
||||
store.dispatch(setAppealType(appealTypeData));
|
||||
store.dispatch(setLPA(lpaData));
|
||||
}
|
||||
let loggedInUser = cookies.pinsUser;
|
||||
|
||||
let thisSession = await getSession(ctx);
|
||||
|
||||
const [accountDetails, appealTypeData, lpaData] = await Promise.all([
|
||||
await getPersonalAccount(loggedInUser),
|
||||
await getAppealsTypes(),
|
||||
await getLPA(),
|
||||
]);
|
||||
const providerConfig = await getProviderConfig();
|
||||
store.dispatch(getGovGatewayConfig(providerConfig));
|
||||
|
||||
// const lpaData = require("../../data/lpa.json");
|
||||
// const appealTypeData = require("../../data/appealtypes.json");
|
||||
|
||||
store.dispatch(setAccountDetails(accountDetails));
|
||||
store.dispatch(setAppealType(appealTypeData));
|
||||
store.dispatch(setLPA(lpaData));
|
||||
store.dispatch(setLoggedInUserId(loggedInUser));
|
||||
}
|
||||
);
|
||||
|
||||
const mapStateToProps = (state) => {
|
||||
|
||||
@@ -7,6 +7,14 @@ import CookieBanner from "../../components/cookieBanner";
|
||||
import Footer from "../../components/footer";
|
||||
import Header from "../../components/header";
|
||||
import Case from "../../components/representation";
|
||||
import { wrapper } from "../../store/store";
|
||||
import { getSession, useSession } from "next-auth/react";
|
||||
import { getPersonalAccount } from "../../actions";
|
||||
import {
|
||||
setAccountDetails,
|
||||
setContainerID,
|
||||
setLoggedInUserId,
|
||||
} from "../../store/accountDetails/action";
|
||||
|
||||
const Home = (props) => {
|
||||
const { footerLinks, pages } = props;
|
||||
@@ -113,10 +121,35 @@ const Home = (props) => {
|
||||
);
|
||||
};
|
||||
|
||||
// export const getServerSideProps = wrapper.getServerSideProps(
|
||||
// (store) => async (ctx) => {
|
||||
// const { query, req, res } = ctx;
|
||||
// console.log("The query", query);
|
||||
|
||||
// const { cookies } = req;
|
||||
|
||||
// let loggedInUser = cookies.pinsUser;
|
||||
|
||||
// let thisSession = await getSession(ctx);
|
||||
|
||||
// console.log(loggedInUser, thisSession);
|
||||
|
||||
// const accountDetails = await getPersonalAccount(loggedInUser);
|
||||
// store.dispatch(setAccountDetails(accountDetails));
|
||||
|
||||
// return {
|
||||
// props: {
|
||||
// containerID: thisSession.user.id,
|
||||
// },
|
||||
// };
|
||||
// }
|
||||
// );
|
||||
|
||||
const mapStateToProps = (state) => {
|
||||
//console.log(state);
|
||||
|
||||
return {
|
||||
accountDetails: state.accountDetails,
|
||||
currentView: state.currentView,
|
||||
search: state.search,
|
||||
searchResultsObj: state.searchResultsObj,
|
||||
|
||||
@@ -3,6 +3,7 @@ import Head from "next/head";
|
||||
import { useRouter } from "next/router";
|
||||
import { connect } from "react-redux";
|
||||
import {
|
||||
getPersonalAccount,
|
||||
getBasicSearch,
|
||||
getPortalModuleDetails,
|
||||
getWatchedCases,
|
||||
@@ -29,6 +30,12 @@ import {
|
||||
import TimeOut from "../../components/timeout";
|
||||
import { getGovGatewayConfig } from "../../store/govgateway/action";
|
||||
import { getProviderConfig } from "../../actions/govgateway";
|
||||
import { getSession, useSession } from "next-auth/react";
|
||||
import {
|
||||
setAccountDetails,
|
||||
setContainerID,
|
||||
setLoggedInUserId,
|
||||
} from "../../store/accountDetails/action";
|
||||
|
||||
const Home = (props) => {
|
||||
const { footerLinks, pages, watchedCases } = props;
|
||||
@@ -73,6 +80,8 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
||||
|
||||
let loggedInUser = cookies.pinsUser;
|
||||
|
||||
let thisSession = await getSession(ctx);
|
||||
|
||||
let [searchResultsObj, watchedCases] = await Promise.all([
|
||||
await getBasicSearch(query.q),
|
||||
await getWatchedCases(loggedInUser),
|
||||
@@ -89,17 +98,21 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
||||
|
||||
//console.log("sssss", searchResultsObj);
|
||||
|
||||
const [searchDetailsObj, watchedCasesDetails] = await Promise.all([
|
||||
await getSearchDetails(searchResultsObj),
|
||||
await getDetails(watchedCases, "myWatchedCases"),
|
||||
]);
|
||||
const [accountDetails, searchDetailsObj, watchedCasesDetails] =
|
||||
await Promise.all([
|
||||
await getPersonalAccount(loggedInUser),
|
||||
await getSearchDetails(searchResultsObj),
|
||||
await getDetails(watchedCases, "myWatchedCases"),
|
||||
]);
|
||||
const providerConfig = await getProviderConfig();
|
||||
store.dispatch(setAccountDetails(accountDetails));
|
||||
store.dispatch(getGovGatewayConfig(providerConfig));
|
||||
store.dispatch(setSearchResults(searchResultsObj));
|
||||
store.dispatch(setSearchDetails(searchDetailsObj));
|
||||
store.dispatch(setSearch(query.q));
|
||||
store.dispatch(setWatchedCases(watchedCases));
|
||||
store.dispatch(setWatchedCasesDetails(watchedCasesDetails));
|
||||
store.dispatch(setLoggedInUserId(loggedInUser));
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user