refactor phase 3a myportal dns imports
This commit is contained in:
@@ -3,15 +3,17 @@ import useTranslation from "next-translate/useTranslation";
|
|||||||
import Head from "next/head";
|
import Head from "next/head";
|
||||||
import { useRouter } from "next/router";
|
import { useRouter } from "next/router";
|
||||||
import { connect } from "react-redux";
|
import { connect } from "react-redux";
|
||||||
|
import { getIP } from "../../../actions/core/logger";
|
||||||
import {
|
import {
|
||||||
getBasicDNSURLSearch,
|
|
||||||
getCaseMessage,
|
|
||||||
getIP,
|
|
||||||
getPersonalAccount,
|
getPersonalAccount,
|
||||||
getPortalLogin,
|
getPortalLogin
|
||||||
|
} from "../../../actions/services/accountService";
|
||||||
|
import {
|
||||||
|
getCaseMessage,
|
||||||
getSIPSEvents,
|
getSIPSEvents,
|
||||||
getSIPSMedia,
|
getSIPSMedia
|
||||||
} from "../../../actions";
|
} from "../../../actions/services/caseService";
|
||||||
|
import { getBasicDNSURLSearch } from "../../../actions/services/searchService";
|
||||||
import Breadcrumbs from "../../../components/breadcrumbs";
|
import Breadcrumbs from "../../../components/breadcrumbs";
|
||||||
import Case from "../../../components/case";
|
import Case from "../../../components/case";
|
||||||
import CookieBanner from "../../../components/cookieBanner";
|
import CookieBanner from "../../../components/cookieBanner";
|
||||||
@@ -25,7 +27,7 @@ import {
|
|||||||
setEventDetails,
|
setEventDetails,
|
||||||
setSearchDetails,
|
setSearchDetails,
|
||||||
setSearchResults,
|
setSearchResults,
|
||||||
setMediaDetails,
|
setMediaDetails
|
||||||
} from "../../../store/searchOutput/action";
|
} from "../../../store/searchOutput/action";
|
||||||
import { wrapper } from "../../../store/store";
|
import { wrapper } from "../../../store/store";
|
||||||
import ServiceBanner from "../../../components/servicebanner";
|
import ServiceBanner from "../../../components/servicebanner";
|
||||||
@@ -35,7 +37,7 @@ const CaseHome = (props) => {
|
|||||||
pages,
|
pages,
|
||||||
setSearchResults,
|
setSearchResults,
|
||||||
setSearchDetails,
|
setSearchDetails,
|
||||||
searchResultsObj,
|
searchResultsObj
|
||||||
} = props;
|
} = props;
|
||||||
let { t, lang } = useTranslation();
|
let { t, lang } = useTranslation();
|
||||||
|
|
||||||
@@ -140,7 +142,7 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
|||||||
if (thisSession) {
|
if (thisSession) {
|
||||||
console.log(" has sesssion.......");
|
console.log(" has sesssion.......");
|
||||||
[loggedInUser] = await Promise.all([
|
[loggedInUser] = await Promise.all([
|
||||||
await getPortalLogin(thisSession.user.email),
|
await getPortalLogin(thisSession.user.email)
|
||||||
]);
|
]);
|
||||||
|
|
||||||
loggedInUser = loggedInUser.value[0].contactid;
|
loggedInUser = loggedInUser.value[0].contactid;
|
||||||
@@ -165,14 +167,14 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
|||||||
|
|
||||||
if (searchResultsObj.value[0].pinswg_appealcasetype == 846040002) {
|
if (searchResultsObj.value[0].pinswg_appealcasetype == 846040002) {
|
||||||
eventsObj = await getSIPSEvents(
|
eventsObj = await getSIPSEvents(
|
||||||
searchDetailsObj[0].value[0].pinswg_sipsid,
|
searchDetailsObj[0].value[0].pinswg_sipsid
|
||||||
);
|
);
|
||||||
store.dispatch(setEventDetails(eventsObj));
|
store.dispatch(setEventDetails(eventsObj));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (searchResultsObj.value[0].pinswg_appealcasetype == 846040002) {
|
if (searchResultsObj.value[0].pinswg_appealcasetype == 846040002) {
|
||||||
mediaObj = await getSIPSMedia(
|
mediaObj = await getSIPSMedia(
|
||||||
searchDetailsObj[0].value[0].pinswg_sipsid,
|
searchDetailsObj[0].value[0].pinswg_sipsid
|
||||||
);
|
);
|
||||||
store.dispatch(setMediaDetails(mediaObj));
|
store.dispatch(setMediaDetails(mediaObj));
|
||||||
}
|
}
|
||||||
@@ -197,15 +199,15 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
|||||||
// });
|
// });
|
||||||
console.log(
|
console.log(
|
||||||
searchResultsObj["@odata.count"] > 1 ||
|
searchResultsObj["@odata.count"] > 1 ||
|
||||||
searchResultsObj["@odata.count"] < 1,
|
searchResultsObj["@odata.count"] < 1
|
||||||
);
|
);
|
||||||
|
|
||||||
if (searchResultsObj["@odata.count"] < 1) {
|
if (searchResultsObj["@odata.count"] < 1) {
|
||||||
return {
|
return {
|
||||||
redirect: {
|
redirect: {
|
||||||
destination: "/404",
|
destination: "/404",
|
||||||
permanent: false,
|
permanent: false
|
||||||
},
|
}
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
if (searchResultsObj["@odata.count"] > 1) {
|
if (searchResultsObj["@odata.count"] > 1) {
|
||||||
@@ -213,8 +215,8 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
|||||||
redirect: {
|
redirect: {
|
||||||
//destination: "/dns-not-found",
|
//destination: "/dns-not-found",
|
||||||
destination: "/404",
|
destination: "/404",
|
||||||
permanent: false,
|
permanent: false
|
||||||
},
|
}
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
// store.dispatch(setSearchResults(searchResultsObj));
|
// store.dispatch(setSearchResults(searchResultsObj));
|
||||||
@@ -237,13 +239,13 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
|||||||
.pinswg_speacialistcaseprocess ||
|
.pinswg_speacialistcaseprocess ||
|
||||||
searchDetailsObj[0].value[0]
|
searchDetailsObj[0].value[0]
|
||||||
.pinswg_specialistcaseprocess
|
.pinswg_specialistcaseprocess
|
||||||
: "",
|
: ""
|
||||||
}),
|
})
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let messagesObj = await getCaseMessage(
|
let messagesObj = await getCaseMessage(
|
||||||
searchResultsObj.value[0].incidentid,
|
searchResultsObj.value[0].incidentid
|
||||||
);
|
);
|
||||||
|
|
||||||
console.log(messagesObj);
|
console.log(messagesObj);
|
||||||
@@ -254,16 +256,16 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
|||||||
searchResultsObj: searchResultsObj,
|
searchResultsObj: searchResultsObj,
|
||||||
searchDetailsObj: searchDetailsObj,
|
searchDetailsObj: searchDetailsObj,
|
||||||
eventsObj: eventsObj,
|
eventsObj: eventsObj,
|
||||||
mediaObj: mediaObj,
|
mediaObj: mediaObj
|
||||||
},
|
},
|
||||||
currentType: "directResultsObj",
|
currentType: "directResultsObj",
|
||||||
docsOffline: process.env.DOCAPI_OFFLINE || false,
|
docsOffline: process.env.DOCAPI_OFFLINE || false,
|
||||||
messagesObj: messagesObj,
|
messagesObj: messagesObj,
|
||||||
showFilteredDocs: process.env.SHOWFILTERDOCS || false,
|
showFilteredDocs: process.env.SHOWFILTERDOCS || false,
|
||||||
showMaps: process.env.SHOWMAPS,
|
showMaps: process.env.SHOWMAPS
|
||||||
},
|
}
|
||||||
};
|
};
|
||||||
},
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
const mapStateToProps = (state) => {
|
const mapStateToProps = (state) => {
|
||||||
@@ -279,7 +281,7 @@ const mapStateToProps = (state) => {
|
|||||||
myCases: state.myCases,
|
myCases: state.myCases,
|
||||||
watchedCases: state.watchedCases,
|
watchedCases: state.watchedCases,
|
||||||
myRepresentations: state.myRepresentations,
|
myRepresentations: state.myRepresentations,
|
||||||
awaitingSubmission: state.awaitingSubmission,
|
awaitingSubmission: state.awaitingSubmission
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -293,7 +295,7 @@ const mapDispatchToProps = (dispatch) => {
|
|||||||
},
|
},
|
||||||
setSearchDetails: (searchDetailsObj) => {
|
setSearchDetails: (searchDetailsObj) => {
|
||||||
dispatch(setSearchDetails(searchDetailsObj));
|
dispatch(setSearchDetails(searchDetailsObj));
|
||||||
},
|
}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -2,14 +2,14 @@ import useTranslation from "next-translate/useTranslation";
|
|||||||
import Head from "next/head";
|
import Head from "next/head";
|
||||||
import { useRouter } from "next/router";
|
import { useRouter } from "next/router";
|
||||||
import { connect } from "react-redux";
|
import { connect } from "react-redux";
|
||||||
|
import { getIP } from "../../actions/core/logger";
|
||||||
|
import { getPersonalAccount } from "../../actions/services/accountService";
|
||||||
|
import { getPortalModuleDetails } from "../../actions/services/caseService";
|
||||||
import {
|
import {
|
||||||
getBasicDNSSearch,
|
getBasicDNSSearch,
|
||||||
getDNSCoords,
|
getDNSCoords
|
||||||
getIP,
|
} from "../../actions/services/searchService";
|
||||||
getPortalModuleDetails,
|
import { getWatchedCases } from "../../actions/services/portalService";
|
||||||
getWatchedCases,
|
|
||||||
getPersonalAccount,
|
|
||||||
} from "../../actions";
|
|
||||||
|
|
||||||
import Breadcrumbs from "../../components/breadcrumbs";
|
import Breadcrumbs from "../../components/breadcrumbs";
|
||||||
import CookieBanner from "../../components/cookieBanner";
|
import CookieBanner from "../../components/cookieBanner";
|
||||||
@@ -18,22 +18,22 @@ import Footer from "../../components/footer";
|
|||||||
import Header from "../../components/header";
|
import Header from "../../components/header";
|
||||||
import {
|
import {
|
||||||
getFormCollectionByID,
|
getFormCollectionByID,
|
||||||
getSearchDetails,
|
getSearchDetails
|
||||||
} from "../../components/utils";
|
} from "../../components/utils";
|
||||||
import {
|
import {
|
||||||
setLoggedInUserId,
|
setLoggedInUserId,
|
||||||
setAccountDetails,
|
setAccountDetails
|
||||||
} from "../../store/accountDetails/action";
|
} from "../../store/accountDetails/action";
|
||||||
import { setSearch } from "../../store/search/action";
|
import { setSearch } from "../../store/search/action";
|
||||||
import {
|
import {
|
||||||
setDNSCoords,
|
setDNSCoords,
|
||||||
setSearchDetails,
|
setSearchDetails,
|
||||||
setSearchResults,
|
setSearchResults
|
||||||
} from "../../store/searchOutput/action";
|
} from "../../store/searchOutput/action";
|
||||||
import { wrapper } from "../../store/store";
|
import { wrapper } from "../../store/store";
|
||||||
import {
|
import {
|
||||||
setWatchedCases,
|
setWatchedCases,
|
||||||
setWatchedCasesDetails,
|
setWatchedCasesDetails
|
||||||
} from "../../store/watchedCases/action";
|
} from "../../store/watchedCases/action";
|
||||||
|
|
||||||
import { getSession } from "next-auth/react";
|
import { getSession } from "next-auth/react";
|
||||||
@@ -158,13 +158,13 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
|||||||
return {
|
return {
|
||||||
redirect: {
|
redirect: {
|
||||||
destination: "/auth/signin",
|
destination: "/auth/signin",
|
||||||
permanent: false,
|
permanent: false
|
||||||
},
|
}
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
let [accountDetails, watchedCases] = await Promise.all([
|
let [accountDetails, watchedCases] = await Promise.all([
|
||||||
await getPersonalAccount(loggedInUser),
|
await getPersonalAccount(loggedInUser),
|
||||||
await getWatchedCases(loggedInUser),
|
await getWatchedCases(loggedInUser)
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// searchResultsObj =
|
// searchResultsObj =
|
||||||
@@ -179,7 +179,7 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
|||||||
const showMapCheck = process.env.SHOWMAPS || false;
|
const showMapCheck = process.env.SHOWMAPS || false;
|
||||||
|
|
||||||
const [watchedCasesDetails] = await Promise.all([
|
const [watchedCasesDetails] = await Promise.all([
|
||||||
await getDetails(watchedCases, "myWatchedCases"),
|
await getDetails(watchedCases, "myWatchedCases")
|
||||||
]);
|
]);
|
||||||
const dnsCoords = await getDNSCoords();
|
const dnsCoords = await getDNSCoords();
|
||||||
// store.dispatch(setSearchResults(searchResultsObj));
|
// store.dispatch(setSearchResults(searchResultsObj));
|
||||||
@@ -192,7 +192,7 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
|||||||
store.dispatch(setAccountDetails(accountDetails));
|
store.dispatch(setAccountDetails(accountDetails));
|
||||||
|
|
||||||
return {
|
return {
|
||||||
props: { showMap: showMapCheck },
|
props: { showMap: showMapCheck }
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -239,7 +239,7 @@ const mapStateToProps = (state) => {
|
|||||||
watchedCases: state.watchedCases,
|
watchedCases: state.watchedCases,
|
||||||
myRepresentations: state.myRepresentations,
|
myRepresentations: state.myRepresentations,
|
||||||
awaitingSubmission: state.awaitingSubmission,
|
awaitingSubmission: state.awaitingSubmission,
|
||||||
accountDetails: state.accountDetails,
|
accountDetails: state.accountDetails
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user