Removed proxy and added api calls, has gov gateway auth
This commit is contained in:
@@ -1,46 +1,31 @@
|
||||
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 SearchResults from "../../components/searchresults";
|
||||
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 { useRouter } from "next/router";
|
||||
import useTranslation from "next-translate/useTranslation";
|
||||
import jsonpath from "jsonpath";
|
||||
import data from "../../data/collections.json";
|
||||
|
||||
import Head from "next/head";
|
||||
import { useRouter } from "next/router";
|
||||
import { connect } from "react-redux";
|
||||
import {
|
||||
getBasicSearch,
|
||||
getPortalModuleDetails,
|
||||
getWatchedCases,
|
||||
} from "../../actions";
|
||||
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,
|
||||
getFormCollectionByID,
|
||||
getSearchDetails,
|
||||
} from "../../components/utils";
|
||||
import { setSearch, getSearchObj } from "../../store/search/action";
|
||||
import { setSearch } from "../../store/search/action";
|
||||
import {
|
||||
setSearchResults,
|
||||
setSearchDetails,
|
||||
setDocumentDetails,
|
||||
setDocumentHistory,
|
||||
getSearchResultsObj,
|
||||
setSearchResults,
|
||||
} from "../../store/searchOutput/action";
|
||||
import { wrapper } from "../../store/store";
|
||||
import {
|
||||
setWatchedCases,
|
||||
setWatchedCasesDetails,
|
||||
} from "../../store/watchedCases/action";
|
||||
import {
|
||||
getBasicSearch,
|
||||
getBasicSearchDetails,
|
||||
getSearchDocumentDetails,
|
||||
getSearchDocumentHistory,
|
||||
getWatchedCases,
|
||||
getPortalModuleDetails,
|
||||
getToken,
|
||||
} from "../../actions";
|
||||
|
||||
const Home = (props) => {
|
||||
const { footerLinks, pages, watchedCases } = props;
|
||||
@@ -65,7 +50,7 @@ const Home = (props) => {
|
||||
<SearchResults
|
||||
searchString={props.search.searchString}
|
||||
searchResultsObj={props.searchResultsObj}
|
||||
myportal="true"
|
||||
myportal={true}
|
||||
watchedCases={watchedCases}
|
||||
/>
|
||||
</div>
|
||||
@@ -82,14 +67,11 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
||||
|
||||
const { cookies } = req;
|
||||
|
||||
let token = await getToken();
|
||||
token = token.access_token;
|
||||
|
||||
let loggedInUser = cookies.pinsUser;
|
||||
|
||||
let [searchResultsObj, watchedCases] = await Promise.all([
|
||||
await getBasicSearch(token, query.q),
|
||||
await getWatchedCases(token, loggedInUser),
|
||||
await getBasicSearch(query.q),
|
||||
await getWatchedCases(loggedInUser),
|
||||
]);
|
||||
|
||||
searchResultsObj =
|
||||
@@ -104,8 +86,8 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
||||
//console.log("sssss", searchResultsObj);
|
||||
|
||||
const [searchDetailsObj, watchedCasesDetails] = await Promise.all([
|
||||
await getSearchDetails(token, searchResultsObj),
|
||||
await getDetails(token, watchedCases, "myWatchedCases"),
|
||||
await getSearchDetails(searchResultsObj),
|
||||
await getDetails(watchedCases, "myWatchedCases"),
|
||||
]);
|
||||
|
||||
store.dispatch(setSearchResults(searchResultsObj));
|
||||
@@ -116,7 +98,7 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
||||
}
|
||||
);
|
||||
|
||||
const getDetails = (token, resultsObj, detailsType) => {
|
||||
const getDetails = (resultsObj, detailsType) => {
|
||||
//console.log(resultsObj);
|
||||
let detailsArr = [];
|
||||
resultsObj = resultsObj.value;
|
||||
@@ -132,7 +114,6 @@ const getDetails = (token, resultsObj, detailsType) => {
|
||||
} else {
|
||||
detailsArr.push(
|
||||
getPortalModuleDetails(
|
||||
token,
|
||||
getFormCollectionByID(searchDetail.pinswg_appealcasetype)
|
||||
.LogicalCollectionName,
|
||||
detailsType != "myWatchedCases"
|
||||
|
||||
Reference in New Issue
Block a user