This commit is contained in:
2022-12-16 11:36:01 +00:00
parent f6d934d951
commit 98aefdd867
36 changed files with 1258 additions and 371 deletions
+3
View File
@@ -88,6 +88,9 @@ export const getServerSideProps = wrapper.getServerSideProps(
store.dispatch(setAppealType(appealTypeData));
store.dispatch(setLPA(lpaData));
store.dispatch(setLoggedInUserId(loggedInUser));
thisSession != false &&
store.dispatch(setContainerID(thisSession.user.id));
}
);
+35 -17
View File
@@ -6,6 +6,7 @@ import {
getAdvancedSearch,
getPortalModuleDetails,
getWatchedCases,
getPersonalAccount,
} from "../../actions";
import Breadcrumbs from "../../components/breadcrumbs";
import CookieBanner from "../../components/cookieBanner";
@@ -20,6 +21,12 @@ import {
setSearchDetails,
setSearchResults,
} from "../../store/searchOutput/action";
import {
setAccountDetails,
setContainerID,
setLoggedInUserId,
} from "../../store/accountDetails/action";
import { setSearch } from "../../store/search/action";
import { wrapper } from "../../store/store";
import {
@@ -27,6 +34,7 @@ import {
setWatchedCasesDetails,
} from "../../store/watchedCases/action";
import TimeOut from "../../components/timeout";
import { getSession, useSession, signIn, signOut } from "next-auth/react";
const Home = (props) => {
const { footerLinks, pages, watchedCases } = props;
@@ -64,30 +72,39 @@ const Home = (props) => {
};
export const getServerSideProps = wrapper.getServerSideProps(
(store) =>
async ({ query, req, res }) => {
console.log("query-", query);
//console.log("search array:", Object.entries(query));
const { cookies } = req;
(store) => async (ctx) => {
const { query, req, res } = ctx;
console.log("query-", query);
//console.log("search array:", Object.entries(query));
const { cookies } = req;
let loggedInUser = cookies.pinsUser;
let loggedInUser = cookies.pinsUser;
let thisSession = await getSession(ctx);
const [searchResultsObj, watchedCases] = await Promise.all([
thisSession != false &&
store.dispatch(setContainerID(thisSession.user.id));
const [accountDetails, searchResultsObj, watchedCases] =
await Promise.all([
await getPersonalAccount(loggedInUser),
await getAdvancedSearch(query),
await getWatchedCases(loggedInUser),
]);
const [searchDetailsObj, watchedCasesDetails] = await Promise.all([
await getSearchDetails(searchResultsObj),
await getDetails(watchedCases, "myWatchedCases"),
]);
console.log(accountDetails);
store.dispatch(setSearchResults(searchResultsObj));
store.dispatch(setSearchDetails(searchDetailsObj));
store.dispatch(setWatchedCases(watchedCases));
store.dispatch(setWatchedCasesDetails(watchedCasesDetails));
store.dispatch(setSearch(Object.entries(query)));
}
const [searchDetailsObj, watchedCasesDetails] = await Promise.all([
await getSearchDetails(searchResultsObj),
await getDetails(watchedCases, "myWatchedCases"),
]);
store.dispatch(setAccountDetails(accountDetails));
store.dispatch(setSearchResults(searchResultsObj));
store.dispatch(setSearchDetails(searchDetailsObj));
store.dispatch(setWatchedCases(watchedCases));
store.dispatch(setWatchedCasesDetails(watchedCasesDetails));
store.dispatch(setSearch(Object.entries(query)));
}
);
const getDetails = (resultsObj, detailsType) => {
@@ -123,6 +140,7 @@ const getDetails = (resultsObj, detailsType) => {
const mapStateToProps = (state) => {
return {
accountDetails: state.accountDetails,
currentView: state.currentView,
search: state.search,
searchResultsObj: state.searchResultsObj,
+7 -1
View File
@@ -14,6 +14,7 @@ import {
getWatchedCases,
consoleLogger,
getCase,
getPortalLogin,
} from "../../actions";
import { createContainer } from "../../actions/azurestorage";
import Breadcrumbs from "../../components/breadcrumbs";
@@ -158,10 +159,15 @@ export const getServerSideProps = wrapper.getServerSideProps(
const { cookies } = req;
let loggedInUser = cookies.pinsUser;
let loggedInUserCookie = cookies.pinsUser;
let thisSession = await getSession(ctx);
let [loggedInUser] = await Promise.all([
await getPortalLogin(thisSession.user.email),
]);
loggedInUser = loggedInUser.value[0].contactid;
console.log("nextAuth Session:", thisSession);
if (_.has(thisSession, "user") == false) {
+3
View File
@@ -99,6 +99,9 @@ const Home = (props) => {
searchResultsObj={
props.searchResultsObj.searchResultsObj
}
searchDetailsObj={
props.searchResultsObj.searchDetailsObj
}
myRepresentations={
props.myRepresentations.myRepresentations
}
+14 -3
View File
@@ -7,6 +7,8 @@ import {
getBasicSearch,
getPortalModuleDetails,
getWatchedCases,
consoleLogger,
getPortalLogin,
} from "../../actions";
import Breadcrumbs from "../../components/breadcrumbs";
import CookieBanner from "../../components/cookieBanner";
@@ -76,13 +78,13 @@ export const getServerSideProps = wrapper.getServerSideProps(
const { cookies } = req;
let loggedInUser = cookies.pinsUser;
let loggedInUserCookie = cookies.pinsUser;
let thisSession = await getSession(ctx);
let [searchResultsObj, watchedCases] = await Promise.all([
let [searchResultsObj, loggedInUser] = await Promise.all([
await getBasicSearch(query.q),
await getWatchedCases(loggedInUser),
await getPortalLogin(thisSession.user.email),
]);
searchResultsObj =
@@ -96,6 +98,12 @@ export const getServerSideProps = wrapper.getServerSideProps(
//console.log("sssss", searchResultsObj);
loggedInUser = loggedInUser.value[0].contactid;
const watchedCases = await getWatchedCases(loggedInUser);
//console.log("sssss", loggedInUser);
const [accountDetails, searchDetailsObj, watchedCasesDetails] =
await Promise.all([
await getPersonalAccount(loggedInUser),
@@ -109,6 +117,9 @@ export const getServerSideProps = wrapper.getServerSideProps(
store.dispatch(setWatchedCases(watchedCases));
store.dispatch(setWatchedCasesDetails(watchedCasesDetails));
store.dispatch(setLoggedInUserId(loggedInUser));
thisSession != false &&
store.dispatch(setContainerID(thisSession.user.id));
}
);