refactor phase 3a pages-dns targeted actions imports
This commit is contained in:
@@ -3,15 +3,17 @@ import useTranslation from "next-translate/useTranslation";
|
||||
import Head from "next/head";
|
||||
import { useRouter } from "next/router";
|
||||
import { connect } from "react-redux";
|
||||
import { getIP } from "../../actions/core/logger";
|
||||
import {
|
||||
getBasicDNSURLSearch,
|
||||
getCaseMessage,
|
||||
getIP,
|
||||
getPersonalAccount,
|
||||
getPortalLogin,
|
||||
getPortalLogin
|
||||
} from "../../actions/services/accountService";
|
||||
import {
|
||||
getCaseMessage,
|
||||
getSIPSEvents,
|
||||
getSIPSMedia,
|
||||
} from "../../actions";
|
||||
getSIPSMedia
|
||||
} from "../../actions/services/caseService";
|
||||
import { getBasicDNSURLSearch } from "../../actions/services/searchService";
|
||||
import Breadcrumbs from "../../components/breadcrumbs";
|
||||
import Case from "../../components/case";
|
||||
import CookieBanner from "../../components/cookieBanner";
|
||||
@@ -25,7 +27,7 @@ import {
|
||||
setEventDetails,
|
||||
setSearchDetails,
|
||||
setSearchResults,
|
||||
setMediaDetails,
|
||||
setMediaDetails
|
||||
} from "../../store/searchOutput/action";
|
||||
import { wrapper } from "../../store/store";
|
||||
import ServiceBanner from "../../components/servicebanner";
|
||||
@@ -35,7 +37,7 @@ const CaseHome = (props) => {
|
||||
pages,
|
||||
setSearchResults,
|
||||
setSearchDetails,
|
||||
searchResultsObj,
|
||||
searchResultsObj
|
||||
} = props;
|
||||
let { t, lang } = useTranslation();
|
||||
|
||||
@@ -143,7 +145,7 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
||||
if (thisSession) {
|
||||
console.log(" has sesssion.......");
|
||||
[loggedInUser] = await Promise.all([
|
||||
await getPortalLogin(thisSession.user.email),
|
||||
await getPortalLogin(thisSession.user.email)
|
||||
]);
|
||||
|
||||
loggedInUser = loggedInUser.value[0].contactid;
|
||||
@@ -168,7 +170,7 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
||||
|
||||
if (searchResultsObj.value[0].pinswg_appealcasetype == 846040002) {
|
||||
eventsObj = await getSIPSEvents(
|
||||
searchDetailsObj[0].value[0].pinswg_sipsid,
|
||||
searchDetailsObj[0].value[0].pinswg_sipsid
|
||||
);
|
||||
|
||||
store.dispatch(setEventDetails(eventsObj));
|
||||
@@ -176,7 +178,7 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
||||
|
||||
if (searchResultsObj.value[0].pinswg_appealcasetype == 846040002) {
|
||||
mediaObj = await getSIPSMedia(
|
||||
searchDetailsObj[0].value[0].pinswg_sipsid,
|
||||
searchDetailsObj[0].value[0].pinswg_sipsid
|
||||
);
|
||||
store.dispatch(setMediaDetails(mediaObj));
|
||||
}
|
||||
@@ -202,15 +204,15 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
||||
// });
|
||||
console.log(
|
||||
searchResultsObj["@odata.count"] > 1 ||
|
||||
searchResultsObj["@odata.count"] < 1,
|
||||
searchResultsObj["@odata.count"] < 1
|
||||
);
|
||||
|
||||
if (searchResultsObj["@odata.count"] < 1) {
|
||||
return {
|
||||
redirect: {
|
||||
destination: "/404",
|
||||
permanent: false,
|
||||
},
|
||||
permanent: false
|
||||
}
|
||||
};
|
||||
} else {
|
||||
if (searchResultsObj["@odata.count"] > 1) {
|
||||
@@ -218,8 +220,8 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
||||
redirect: {
|
||||
//destination: "/dns-not-found",
|
||||
destination: "/404",
|
||||
permanent: false,
|
||||
},
|
||||
permanent: false
|
||||
}
|
||||
};
|
||||
} else {
|
||||
// store.dispatch(setSearchResults(searchResultsObj));
|
||||
@@ -242,13 +244,13 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
||||
.pinswg_speacialistcaseprocess ||
|
||||
searchDetailsObj[0].value[0]
|
||||
.pinswg_specialistcaseprocess
|
||||
: "",
|
||||
}),
|
||||
: ""
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
||||
let messagesObj = await getCaseMessage(
|
||||
searchResultsObj.value[0].incidentid,
|
||||
searchResultsObj.value[0].incidentid
|
||||
);
|
||||
|
||||
console.log(messagesObj);
|
||||
@@ -259,16 +261,16 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
||||
searchResultsObj: searchResultsObj,
|
||||
searchDetailsObj: searchDetailsObj,
|
||||
eventsObj: eventsObj,
|
||||
mediaObj: mediaObj,
|
||||
mediaObj: mediaObj
|
||||
},
|
||||
currentType: "directResultsObj",
|
||||
docsOffline: process.env.DOCAPI_OFFLINE || false,
|
||||
messagesObj: messagesObj,
|
||||
showFilteredDocs: process.env.SHOWFILTERDOCS || false,
|
||||
showMaps: process.env.SHOWMAPS,
|
||||
},
|
||||
showMaps: process.env.SHOWMAPS
|
||||
}
|
||||
};
|
||||
},
|
||||
}
|
||||
);
|
||||
|
||||
const mapStateToProps = (state) => {
|
||||
@@ -284,7 +286,7 @@ const mapStateToProps = (state) => {
|
||||
myCases: state.myCases,
|
||||
watchedCases: state.watchedCases,
|
||||
myRepresentations: state.myRepresentations,
|
||||
awaitingSubmission: state.awaitingSubmission,
|
||||
awaitingSubmission: state.awaitingSubmission
|
||||
};
|
||||
};
|
||||
|
||||
@@ -298,7 +300,7 @@ const mapDispatchToProps = (dispatch) => {
|
||||
},
|
||||
setSearchDetails: (searchDetailsObj) => {
|
||||
dispatch(setSearchDetails(searchDetailsObj));
|
||||
},
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
+13
-15
@@ -2,7 +2,7 @@ import useTranslation from "next-translate/useTranslation";
|
||||
import Head from "next/head";
|
||||
import { useRouter } from "next/router";
|
||||
import { connect } from "react-redux";
|
||||
import { getDNSList } from "../../actions";
|
||||
import { getDNSList } from "../../actions/services/searchService";
|
||||
import CookieBanner from "../../components/cookieBanner";
|
||||
import Main from "../../components/dns//main";
|
||||
import Footer from "../../components/footer";
|
||||
@@ -15,7 +15,7 @@ import { getSearchDetails } from "../../components/utils";
|
||||
import { setSearch } from "../../store/search/action";
|
||||
import {
|
||||
setSearchDetails,
|
||||
setSearchResults,
|
||||
setSearchResults
|
||||
} from "../../store/searchOutput/action";
|
||||
|
||||
const Home = (props) => {
|
||||
@@ -64,8 +64,8 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
||||
redirect: {
|
||||
//destination: "/dns-not-found",
|
||||
destination: "/error",
|
||||
permanent: false,
|
||||
},
|
||||
permanent: false
|
||||
}
|
||||
};
|
||||
} else {
|
||||
searchResultsObj =
|
||||
@@ -73,21 +73,19 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
||||
? {
|
||||
value: [],
|
||||
errorCode: searchResultsObj.status,
|
||||
errorMsg: searchResultsObj.statusText,
|
||||
errorMsg: searchResultsObj.statusText
|
||||
}
|
||||
: searchResultsObj;
|
||||
|
||||
const searchDetailsObj = await getSearchDetails(
|
||||
searchResultsObj
|
||||
);
|
||||
const searchDetailsObj =
|
||||
await getSearchDetails(searchResultsObj);
|
||||
store.dispatch(setSearchResults(searchResultsObj));
|
||||
store.dispatch(setSearchDetails(searchDetailsObj));
|
||||
store.dispatch(setSearch("DNS"));
|
||||
}
|
||||
} else {
|
||||
const searchDetailsObj = await getSearchDetails(
|
||||
searchResultsObj
|
||||
);
|
||||
const searchDetailsObj =
|
||||
await getSearchDetails(searchResultsObj);
|
||||
store.dispatch(setSearchResults(searchResultsObj));
|
||||
store.dispatch(setSearchDetails(searchDetailsObj));
|
||||
store.dispatch(setSearch("DNS"));
|
||||
@@ -95,9 +93,9 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
||||
return {
|
||||
props: {
|
||||
searchResultsObj: {
|
||||
searchResultsObj: searchResultsObj,
|
||||
},
|
||||
},
|
||||
searchResultsObj: searchResultsObj
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
);
|
||||
@@ -113,7 +111,7 @@ const mapStateToProps = (state) => {
|
||||
myCases: state.myCases,
|
||||
watchedCases: state.watchedCases,
|
||||
myRepresentations: state.myRepresentations,
|
||||
awaitingSubmission: state.awaitingSubmission,
|
||||
awaitingSubmission: state.awaitingSubmission
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user