refactor phase 3a myportal index targeted actions imports
This commit is contained in:
+31
-25
@@ -5,19 +5,25 @@ import { useRouter } from "next/router";
|
|||||||
import { connect } from "react-redux";
|
import { connect } from "react-redux";
|
||||||
import pLimit from "p-limit";
|
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 {
|
import {
|
||||||
createContainerProxy,
|
createContainerProxy,
|
||||||
getAwaitingSubmissionFromBlob,
|
getAwaitingSubmissionFromBlob,
|
||||||
getCase,
|
getRepsFromBlob
|
||||||
getIP,
|
} from "../../actions/services/documentService";
|
||||||
|
import {
|
||||||
getMyCases,
|
getMyCases,
|
||||||
getMyLPACases,
|
getMyLPACases,
|
||||||
getPersonalAccount,
|
getWatchedCases
|
||||||
getPortalLogin,
|
} from "../../actions/services/portalService";
|
||||||
getPortalModuleDetails,
|
|
||||||
getRepsFromBlob,
|
|
||||||
getWatchedCases,
|
|
||||||
} from "../../actions";
|
|
||||||
|
|
||||||
import Breadcrumbs from "../../components/breadcrumbs";
|
import Breadcrumbs from "../../components/breadcrumbs";
|
||||||
import CookieBanner from "../../components/cookieBanner";
|
import CookieBanner from "../../components/cookieBanner";
|
||||||
@@ -29,12 +35,12 @@ import { getFormCollectionByID } from "../../components/utils";
|
|||||||
import {
|
import {
|
||||||
setAccountDetails,
|
setAccountDetails,
|
||||||
setContainerID,
|
setContainerID,
|
||||||
setLoggedInUserId,
|
setLoggedInUserId
|
||||||
} from "../../store/accountDetails/action";
|
} from "../../store/accountDetails/action";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
setAwaitingSubmissionDetails,
|
setAwaitingSubmissionDetails,
|
||||||
setAwaitingSubmissionFromBlob,
|
setAwaitingSubmissionFromBlob
|
||||||
} from "../../store/awaitingSubmission/action";
|
} from "../../store/awaitingSubmission/action";
|
||||||
|
|
||||||
import { setShowReps, setLocale } from "../../store/currentView/action";
|
import { setShowReps, setLocale } from "../../store/currentView/action";
|
||||||
@@ -45,14 +51,14 @@ import {
|
|||||||
setMyRepresentations,
|
setMyRepresentations,
|
||||||
setMyRepresentationsDetails,
|
setMyRepresentationsDetails,
|
||||||
setMySubmittedReps,
|
setMySubmittedReps,
|
||||||
setMySubmittedRepsDetails,
|
setMySubmittedRepsDetails
|
||||||
} from "../../store/myRepresentations/action";
|
} from "../../store/myRepresentations/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";
|
||||||
|
|
||||||
const Home = (props) => {
|
const Home = (props) => {
|
||||||
@@ -67,7 +73,7 @@ const Home = (props) => {
|
|||||||
showLoginCheck,
|
showLoginCheck,
|
||||||
currentView,
|
currentView,
|
||||||
mySubmittedReps,
|
mySubmittedReps,
|
||||||
docsOffline,
|
docsOffline
|
||||||
} = props;
|
} = props;
|
||||||
|
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
@@ -179,7 +185,7 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
|||||||
|
|
||||||
if (!thisSession) {
|
if (!thisSession) {
|
||||||
return {
|
return {
|
||||||
redirect: { destination: "/auth/signin", permanent: false },
|
redirect: { destination: "/auth/signin", permanent: false }
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -195,8 +201,8 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
|||||||
locale === "cy"
|
locale === "cy"
|
||||||
? "/cy/manylionpellach"
|
? "/cy/manylionpellach"
|
||||||
: "/furtherdetails",
|
: "/furtherdetails",
|
||||||
permanent: false,
|
permanent: false
|
||||||
},
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -207,7 +213,7 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
|||||||
|
|
||||||
if (accountDetails?.errorCode) {
|
if (accountDetails?.errorCode) {
|
||||||
return {
|
return {
|
||||||
redirect: { destination: "/myportal/error", permanent: false },
|
redirect: { destination: "/myportal/error", permanent: false }
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -222,12 +228,12 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
|||||||
myCases,
|
myCases,
|
||||||
myRepresentations,
|
myRepresentations,
|
||||||
watchedCases,
|
watchedCases,
|
||||||
awaitingSubmissionFromBlob,
|
awaitingSubmissionFromBlob
|
||||||
] = await Promise.all([
|
] = await Promise.all([
|
||||||
isLPA ? getMyLPACases(lpaId) : getMyCases(loggedInUser),
|
isLPA ? getMyLPACases(lpaId) : getMyCases(loggedInUser),
|
||||||
getRepsFromBlob(thisSession.user.id),
|
getRepsFromBlob(thisSession.user.id),
|
||||||
getWatchedCases(loggedInUser),
|
getWatchedCases(loggedInUser),
|
||||||
getAwaitingSubmissionFromBlob(thisSession.user.id),
|
getAwaitingSubmissionFromBlob(thisSession.user.id)
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// put current locale into store (this is the URL locale)
|
// put current locale into store (this is the URL locale)
|
||||||
@@ -260,7 +266,7 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
|||||||
).length,
|
).length,
|
||||||
value: watchedCases.value.filter(
|
value: watchedCases.value.filter(
|
||||||
(c) => c.pinswg_representationsubmitted == null
|
(c) => c.pinswg_representationsubmitted == null
|
||||||
),
|
)
|
||||||
};
|
};
|
||||||
|
|
||||||
// submitted reps derived from watched cases
|
// submitted reps derived from watched cases
|
||||||
@@ -334,12 +340,12 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
|||||||
myCasesDetails,
|
myCasesDetails,
|
||||||
watchedCasesDetails,
|
watchedCasesDetails,
|
||||||
mySubmittedRepsDetails,
|
mySubmittedRepsDetails,
|
||||||
myRepresentationsDetails,
|
myRepresentationsDetails
|
||||||
] = await Promise.all([
|
] = await Promise.all([
|
||||||
getDetails(myCases, "myCases"),
|
getDetails(myCases, "myCases"),
|
||||||
getDetails(filteredWatchedCases, "myWatchedCases"),
|
getDetails(filteredWatchedCases, "myWatchedCases"),
|
||||||
getDetails(mySubmittedReps, "mySubmittedReps"),
|
getDetails(mySubmittedReps, "mySubmittedReps"),
|
||||||
getDetails(myRepresentations, "myRepresentations"),
|
getDetails(myRepresentations, "myRepresentations")
|
||||||
]);
|
]);
|
||||||
|
|
||||||
store.dispatch(setAccountDetails(accountDetails));
|
store.dispatch(setAccountDetails(accountDetails));
|
||||||
@@ -365,8 +371,8 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
|||||||
showFileUpload: Boolean(process.env.SHOWFILEUPLOAD),
|
showFileUpload: Boolean(process.env.SHOWFILEUPLOAD),
|
||||||
containerID: thisSession.user.id,
|
containerID: thisSession.user.id,
|
||||||
showLoginCheck,
|
showLoginCheck,
|
||||||
docsOffline: process.env.DOCAPI_OFFLINE || false,
|
docsOffline: process.env.DOCAPI_OFFLINE || false
|
||||||
},
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@@ -383,7 +389,7 @@ const mapStateToProps = (state) => ({
|
|||||||
watchedCases: state.watchedCases,
|
watchedCases: state.watchedCases,
|
||||||
myRepresentations: state.myRepresentations,
|
myRepresentations: state.myRepresentations,
|
||||||
mySubmittedReps: state.myRepresentations.mySubmittedReps,
|
mySubmittedReps: state.myRepresentations.mySubmittedReps,
|
||||||
awaitingSubmission: state.awaitingSubmission,
|
awaitingSubmission: state.awaitingSubmission
|
||||||
});
|
});
|
||||||
|
|
||||||
export default connect(mapStateToProps)(Home);
|
export default connect(mapStateToProps)(Home);
|
||||||
|
|||||||
Reference in New Issue
Block a user