refactor phase 3a top-level pages targeted actions imports
This commit is contained in:
@@ -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 { getAddressSearch } from "../actions";
|
||||
import { getAddressSearch } from "../actions/services/searchService";
|
||||
import SearchResults from "../components/addresssearchresults";
|
||||
import Breadcrumbs from "../components/breadcrumbs";
|
||||
import CookieBanner from "../components/cookieBanner";
|
||||
@@ -125,11 +125,11 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
||||
props: {
|
||||
searchResultsObj: {
|
||||
searchResultsObj: searchResultsObj,
|
||||
searchDetailsObj: searchDetailsObj,
|
||||
searchDetailsObj: searchDetailsObj
|
||||
},
|
||||
currentType: "directResultsObj",
|
||||
showLoginCheck: showLoginCheck,
|
||||
},
|
||||
showLoginCheck: showLoginCheck
|
||||
}
|
||||
};
|
||||
}
|
||||
);
|
||||
@@ -145,7 +145,7 @@ const mapStateToProps = (state) => {
|
||||
myCases: state.myCases,
|
||||
watchedCases: state.watchedCases,
|
||||
myRepresentations: state.myRepresentations,
|
||||
awaitingSubmission: state.awaitingSubmission,
|
||||
awaitingSubmission: state.awaitingSubmission
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@@ -3,7 +3,11 @@ import useTranslation from "next-translate/useTranslation";
|
||||
import Head from "next/head";
|
||||
import { useRouter } from "next/router";
|
||||
import { connect } from "react-redux";
|
||||
import { getAppealsTypes, getProjectTypes, getLPA } from "../actions";
|
||||
import {
|
||||
getAppealsTypes,
|
||||
getProjectTypes,
|
||||
getLPA
|
||||
} from "../actions/services/referenceDataService";
|
||||
import Breadcrumbs from "../components/breadcrumbs";
|
||||
import CookieBanner from "../components/cookieBanner";
|
||||
import CRMError from "../components/crmError";
|
||||
@@ -126,7 +130,7 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
||||
let [appealTypeData, projectTypeData, lpaData] = await Promise.all([
|
||||
await getAppealsTypes(),
|
||||
await getProjectTypes(),
|
||||
await getLPA(),
|
||||
await getLPA()
|
||||
]);
|
||||
|
||||
//const lpaData = require("../data/lpa.json");
|
||||
@@ -146,7 +150,7 @@ const mapStateToProps = (state) => {
|
||||
appealType: state.appealType,
|
||||
LPAData: state.LPAData,
|
||||
//form: state.form,
|
||||
accountDetails: state.accountDetails,
|
||||
accountDetails: state.accountDetails
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@@ -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 { getAdvancedSearch } from "../actions";
|
||||
import { getAdvancedSearch } from "../actions/services/searchService";
|
||||
import Breadcrumbs from "../components/breadcrumbs";
|
||||
import CookieBanner from "../components/cookieBanner";
|
||||
import Footer from "../components/footer";
|
||||
@@ -13,7 +13,7 @@ import { setShowReps } from "../store/currentView/action";
|
||||
import { setSearch } from "../store/search/action";
|
||||
import {
|
||||
setSearchDetails,
|
||||
setSearchResults,
|
||||
setSearchResults
|
||||
} from "../store/searchOutput/action";
|
||||
import ServiceBanner from "../components/servicebanner";
|
||||
import { wrapper } from "../store/store";
|
||||
@@ -140,8 +140,8 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
||||
store.dispatch(setSearch(Object.entries(query)));
|
||||
return {
|
||||
props: {
|
||||
showLoginCheck: showLoginCheck,
|
||||
},
|
||||
showLoginCheck: showLoginCheck
|
||||
}
|
||||
};
|
||||
}
|
||||
);
|
||||
@@ -157,7 +157,7 @@ const mapStateToProps = (state) => {
|
||||
myCases: state.myCases,
|
||||
watchedCases: state.watchedCases,
|
||||
myRepresentations: state.myRepresentations,
|
||||
awaitingSubmission: state.awaitingSubmission,
|
||||
awaitingSubmission: state.awaitingSubmission
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
+10
-9
@@ -13,10 +13,11 @@ import {
|
||||
formValueSelector,
|
||||
reduxForm,
|
||||
touch,
|
||||
SubmissionError,
|
||||
SubmissionError
|
||||
} from "redux-form";
|
||||
import { connect } from "react-redux";
|
||||
import { createCRMTask, sendEmail } from "../actions";
|
||||
import { createCRMTask } from "../actions/services/integrationService";
|
||||
import { sendEmail } from "../actions/services/notifyService";
|
||||
|
||||
import { useState } from "react";
|
||||
|
||||
@@ -28,7 +29,7 @@ const RenderPickList = ({
|
||||
label,
|
||||
input,
|
||||
errorMsg,
|
||||
meta: { touched, error },
|
||||
meta: { touched, error }
|
||||
}) => {
|
||||
let { t } = useTranslation();
|
||||
|
||||
@@ -318,7 +319,7 @@ let ContactUs = (props) => {
|
||||
const sendContactEmail = async (formValues) => {
|
||||
Object.assign(formValues, {
|
||||
"contactSubject": contactPurpose(formValues.typeOfContact).props
|
||||
.children,
|
||||
.children
|
||||
});
|
||||
|
||||
const reference = "PEDW-CONTACT-US";
|
||||
@@ -340,7 +341,7 @@ let ContactUs = (props) => {
|
||||
alert("Something went wrong. Please try again later.");
|
||||
// Required: inform redux-form this is a submit error
|
||||
throw new SubmissionError({
|
||||
_error: "Failed to send email. Please try again later.",
|
||||
_error: "Failed to send email. Please try again later."
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -367,7 +368,7 @@ let ContactUs = (props) => {
|
||||
alert("Something went wrong. Please try again later.");
|
||||
// Required: inform redux-form this is a submit error
|
||||
throw new SubmissionError({
|
||||
_error: "Failed to send email. Please try again later.",
|
||||
_error: "Failed to send email. Please try again later."
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -513,7 +514,7 @@ const mapStateToProps = (state) => {
|
||||
return {
|
||||
typeOfContactValue,
|
||||
initialValues: email ? { contactEmail: email } : {},
|
||||
petEmail: process.env.NEXT_PUBLIC_PETEMAIL,
|
||||
petEmail: process.env.NEXT_PUBLIC_PETEMAIL
|
||||
};
|
||||
};
|
||||
|
||||
@@ -544,7 +545,7 @@ export default connect(
|
||||
) {
|
||||
errorElement.scrollIntoView({
|
||||
behavior: "smooth",
|
||||
block: "center",
|
||||
block: "center"
|
||||
});
|
||||
errorElement.focus({ preventScroll: true });
|
||||
} else {
|
||||
@@ -556,6 +557,6 @@ export default connect(
|
||||
}
|
||||
|
||||
console.log("Redux Form onSubmitFail:", submitError);
|
||||
},
|
||||
}
|
||||
})(ContactUs)
|
||||
);
|
||||
|
||||
@@ -3,7 +3,10 @@ import useTranslation from "next-translate/useTranslation";
|
||||
import Head from "next/head";
|
||||
import { useRouter } from "next/router";
|
||||
import { connect } from "react-redux";
|
||||
import { getBasicDNSSearch, getDNSCoords } from "../actions";
|
||||
import {
|
||||
getBasicDNSSearch,
|
||||
getDNSCoords
|
||||
} from "../actions/services/searchService";
|
||||
import Breadcrumbs from "../components/breadcrumbs";
|
||||
import CookieBanner from "../components/cookieBanner";
|
||||
import DNSSearchResults from "../components/dnssearchresults";
|
||||
@@ -14,7 +17,7 @@ import { setSearch } from "../store/search/action";
|
||||
import {
|
||||
setSearchDetails,
|
||||
setSearchResults,
|
||||
setDNSCoords,
|
||||
setDNSCoords
|
||||
} from "../store/searchOutput/action";
|
||||
import { wrapper } from "../store/store";
|
||||
import ServiceBanner from "../components/servicebanner";
|
||||
@@ -163,8 +166,8 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
||||
return {
|
||||
props: {
|
||||
showMap: showMapCheck,
|
||||
showLoginCheck: showLoginCheck,
|
||||
},
|
||||
showLoginCheck: showLoginCheck
|
||||
}
|
||||
};
|
||||
}
|
||||
);
|
||||
@@ -180,7 +183,7 @@ const mapStateToProps = (state) => {
|
||||
myCases: state.myCases,
|
||||
watchedCases: state.watchedCases,
|
||||
myRepresentations: state.myRepresentations,
|
||||
awaitingSubmission: state.awaitingSubmission,
|
||||
awaitingSubmission: state.awaitingSubmission
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
+31
-23
@@ -5,7 +5,10 @@ import Head from "next/head";
|
||||
import { useRouter } from "next/router";
|
||||
import { setCookie } from "nookies";
|
||||
import { connect } from "react-redux";
|
||||
import { getIP, getPortalLogin, getToken, hashString } from "../actions";
|
||||
import { hashString } from "../actions/core/hash";
|
||||
import { getIP } from "../actions/core/logger";
|
||||
import { getToken } from "../actions/core/token";
|
||||
import { getPortalLogin } from "../actions/services/accountService";
|
||||
import CookieBanner from "../components/cookieBanner";
|
||||
import Footer from "../components/footer";
|
||||
import Header from "../components/header";
|
||||
@@ -25,7 +28,7 @@ const Home = (props) => {
|
||||
loginEmailStr,
|
||||
loggedInUserEmail,
|
||||
hasLoginCode,
|
||||
siteurl,
|
||||
siteurl
|
||||
} = props;
|
||||
let { t, lang } = useTranslation();
|
||||
|
||||
@@ -46,24 +49,29 @@ const Home = (props) => {
|
||||
hasLoginCode == false
|
||||
? "" //console.log("no session")
|
||||
: _.has(loggedInUserId, "value")
|
||||
? _.isEmpty(loggedInUserId.value)
|
||||
? router.replace({
|
||||
pathname:
|
||||
router.locale == "cy"
|
||||
? "/account/register"
|
||||
: "/account/register",
|
||||
query: {
|
||||
id: encodeURI(loggedInUserEmail),
|
||||
},
|
||||
})
|
||||
: (setCookie(null, "pinsUser", loggedInUserId.value[0].contactid, {
|
||||
path: "/",
|
||||
}),
|
||||
router.replace({
|
||||
pathname:
|
||||
router.locale == "cy" ? "/cy/fymhorth" : "/myportal",
|
||||
}))
|
||||
: console.log("no value in user id");
|
||||
? _.isEmpty(loggedInUserId.value)
|
||||
? router.replace({
|
||||
pathname:
|
||||
router.locale == "cy"
|
||||
? "/account/register"
|
||||
: "/account/register",
|
||||
query: {
|
||||
id: encodeURI(loggedInUserEmail)
|
||||
}
|
||||
})
|
||||
: (setCookie(
|
||||
null,
|
||||
"pinsUser",
|
||||
loggedInUserId.value[0].contactid,
|
||||
{
|
||||
path: "/"
|
||||
}
|
||||
),
|
||||
router.replace({
|
||||
pathname:
|
||||
router.locale == "cy" ? "/cy/fymhorth" : "/myportal"
|
||||
}))
|
||||
: console.log("no value in user id");
|
||||
|
||||
return (
|
||||
<div>
|
||||
@@ -194,8 +202,8 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
||||
loggedInUserId: portalUserObj,
|
||||
loggedInUserEmail: loginEmailStr,
|
||||
hasLoginCode: hasLoginCode,
|
||||
siteurl: process.env.API_ROOT,
|
||||
},
|
||||
siteurl: process.env.API_ROOT
|
||||
}
|
||||
};
|
||||
}
|
||||
);
|
||||
@@ -211,7 +219,7 @@ const mapStateToProps = (state) => {
|
||||
myCases: state.myCases,
|
||||
watchedCases: state.watchedCases,
|
||||
myRepresentations: state.myRepresentations,
|
||||
awaitingSubmission: state.awaitingSubmission,
|
||||
awaitingSubmission: state.awaitingSubmission
|
||||
};
|
||||
};
|
||||
export default connect(mapStateToProps)(Home);
|
||||
|
||||
@@ -3,7 +3,8 @@ import useTranslation from "next-translate/useTranslation";
|
||||
import Head from "next/head";
|
||||
import { useRouter } from "next/router";
|
||||
import { connect } from "react-redux";
|
||||
import { getBasicSearch, getIP } from "../actions";
|
||||
import { getIP } from "../actions/core/logger";
|
||||
import { getBasicSearch } from "../actions/services/searchService";
|
||||
import Breadcrumbs from "../components/breadcrumbs";
|
||||
import CookieBanner from "../components/cookieBanner";
|
||||
import Footer from "../components/footer";
|
||||
@@ -14,7 +15,7 @@ import { setShowReps } from "../store/currentView/action";
|
||||
import { setSearch } from "../store/search/action";
|
||||
import {
|
||||
setSearchDetails,
|
||||
setSearchResults,
|
||||
setSearchResults
|
||||
} from "../store/searchOutput/action";
|
||||
import { wrapper } from "../store/store";
|
||||
import ServiceBanner from "../components/servicebanner";
|
||||
@@ -163,8 +164,8 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
||||
return {
|
||||
props: {
|
||||
isLinkedCase: isLinked,
|
||||
showLoginCheck: showLoginCheck,
|
||||
},
|
||||
showLoginCheck: showLoginCheck
|
||||
}
|
||||
};
|
||||
}
|
||||
// }
|
||||
@@ -182,7 +183,7 @@ const mapStateToProps = (state) => {
|
||||
myCases: state.myCases,
|
||||
watchedCases: state.watchedCases,
|
||||
myRepresentations: state.myRepresentations,
|
||||
awaitingSubmission: state.awaitingSubmission,
|
||||
awaitingSubmission: state.awaitingSubmission
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
+2
-2
@@ -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 { getBasicSearch } from "../actions";
|
||||
import { getBasicSearch } from "../actions/services/searchService";
|
||||
import Breadcrumbs from "../components/breadcrumbs";
|
||||
import CookieBanner from "../components/cookieBanner";
|
||||
import Footer from "../components/footer";
|
||||
@@ -119,7 +119,7 @@ const mapStateToProps = (state) => {
|
||||
search: state.search,
|
||||
searchResultsObj: state.searchResultsObj,
|
||||
form: state.form,
|
||||
currentView: state.currentView,
|
||||
currentView: state.currentView
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user