From dacf2511f54f420020101c7f79ff4a211aa7955f Mon Sep 17 00:00:00 2001 From: robbond Date: Thu, 12 Mar 2026 09:25:56 +0000 Subject: [PATCH] refactor phase 3a myportal index targeted actions imports --- pages/myportal/index.js | 56 +++++++++++++++++++++++------------------ 1 file changed, 31 insertions(+), 25 deletions(-) diff --git a/pages/myportal/index.js b/pages/myportal/index.js index 9bfd8b69..4f61761b 100644 --- a/pages/myportal/index.js +++ b/pages/myportal/index.js @@ -5,19 +5,25 @@ import { useRouter } from "next/router"; import { connect } from "react-redux"; import pLimit from "p-limit"; +import { getIP } from "../../actions/core/logger"; +import { + getPersonalAccount, + getPortalLogin +} from "../../actions/services/accountService"; +import { + getCase, + getPortalModuleDetails +} from "../../actions/services/caseService"; import { createContainerProxy, getAwaitingSubmissionFromBlob, - getCase, - getIP, + getRepsFromBlob +} from "../../actions/services/documentService"; +import { getMyCases, getMyLPACases, - getPersonalAccount, - getPortalLogin, - getPortalModuleDetails, - getRepsFromBlob, - getWatchedCases, -} from "../../actions"; + getWatchedCases +} from "../../actions/services/portalService"; import Breadcrumbs from "../../components/breadcrumbs"; import CookieBanner from "../../components/cookieBanner"; @@ -29,12 +35,12 @@ import { getFormCollectionByID } from "../../components/utils"; import { setAccountDetails, setContainerID, - setLoggedInUserId, + setLoggedInUserId } from "../../store/accountDetails/action"; import { setAwaitingSubmissionDetails, - setAwaitingSubmissionFromBlob, + setAwaitingSubmissionFromBlob } from "../../store/awaitingSubmission/action"; import { setShowReps, setLocale } from "../../store/currentView/action"; @@ -45,14 +51,14 @@ import { setMyRepresentations, setMyRepresentationsDetails, setMySubmittedReps, - setMySubmittedRepsDetails, + setMySubmittedRepsDetails } from "../../store/myRepresentations/action"; import { wrapper } from "../../store/store"; import { setWatchedCases, - setWatchedCasesDetails, + setWatchedCasesDetails } from "../../store/watchedCases/action"; const Home = (props) => { @@ -67,7 +73,7 @@ const Home = (props) => { showLoginCheck, currentView, mySubmittedReps, - docsOffline, + docsOffline } = props; const { t } = useTranslation(); @@ -179,7 +185,7 @@ export const getServerSideProps = wrapper.getServerSideProps( if (!thisSession) { return { - redirect: { destination: "/auth/signin", permanent: false }, + redirect: { destination: "/auth/signin", permanent: false } }; } @@ -195,8 +201,8 @@ export const getServerSideProps = wrapper.getServerSideProps( locale === "cy" ? "/cy/manylionpellach" : "/furtherdetails", - permanent: false, - }, + permanent: false + } }; } @@ -207,7 +213,7 @@ export const getServerSideProps = wrapper.getServerSideProps( if (accountDetails?.errorCode) { return { - redirect: { destination: "/myportal/error", permanent: false }, + redirect: { destination: "/myportal/error", permanent: false } }; } @@ -222,12 +228,12 @@ export const getServerSideProps = wrapper.getServerSideProps( myCases, myRepresentations, watchedCases, - awaitingSubmissionFromBlob, + awaitingSubmissionFromBlob ] = await Promise.all([ isLPA ? getMyLPACases(lpaId) : getMyCases(loggedInUser), getRepsFromBlob(thisSession.user.id), getWatchedCases(loggedInUser), - getAwaitingSubmissionFromBlob(thisSession.user.id), + getAwaitingSubmissionFromBlob(thisSession.user.id) ]); // put current locale into store (this is the URL locale) @@ -260,7 +266,7 @@ export const getServerSideProps = wrapper.getServerSideProps( ).length, value: watchedCases.value.filter( (c) => c.pinswg_representationsubmitted == null - ), + ) }; // submitted reps derived from watched cases @@ -334,12 +340,12 @@ export const getServerSideProps = wrapper.getServerSideProps( myCasesDetails, watchedCasesDetails, mySubmittedRepsDetails, - myRepresentationsDetails, + myRepresentationsDetails ] = await Promise.all([ getDetails(myCases, "myCases"), getDetails(filteredWatchedCases, "myWatchedCases"), getDetails(mySubmittedReps, "mySubmittedReps"), - getDetails(myRepresentations, "myRepresentations"), + getDetails(myRepresentations, "myRepresentations") ]); store.dispatch(setAccountDetails(accountDetails)); @@ -365,8 +371,8 @@ export const getServerSideProps = wrapper.getServerSideProps( showFileUpload: Boolean(process.env.SHOWFILEUPLOAD), containerID: thisSession.user.id, showLoginCheck, - docsOffline: process.env.DOCAPI_OFFLINE || false, - }, + docsOffline: process.env.DOCAPI_OFFLINE || false + } }; } ); @@ -383,7 +389,7 @@ const mapStateToProps = (state) => ({ watchedCases: state.watchedCases, myRepresentations: state.myRepresentations, mySubmittedReps: state.myRepresentations.mySubmittedReps, - awaitingSubmission: state.awaitingSubmission, + awaitingSubmission: state.awaitingSubmission }); export default connect(mapStateToProps)(Home);