refactor phase 3a top-level pages targeted actions imports
This commit is contained in:
+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);
|
||||
|
||||
Reference in New Issue
Block a user