removed gov gateway references

This commit is contained in:
2022-10-18 11:51:30 +01:00
parent 5f7908c0c2
commit 8c5b299412
17 changed files with 87 additions and 191 deletions
+21 -75
View File
@@ -4,13 +4,7 @@ import Head from "next/head";
import { useRouter } from "next/router";
import { setCookie } from "nookies";
import { connect } from "react-redux";
import { getNotice, getToken, hashString } from "../actions";
import {
getGGToken,
getPortalLogin,
getProviderConfig,
getUserInfo,
} from "../actions/govgateway";
import { getNotice, getToken, hashString, getPortalLogin } from "../actions";
import CookieBanner from "../components/cookieBanner";
import Footer from "../components/footer";
import Header from "../components/header";
@@ -21,7 +15,6 @@ import {
setAccountDetails,
setContainerID,
} from "../store/accountDetails/action";
import { getGovGatewayConfig } from "../store/govgateway/action";
import { wrapper } from "../store/store";
import { getSession, useSession, signIn, signOut } from "next-auth/react";
@@ -32,10 +25,8 @@ const Home = (props) => {
showLogin,
showMap,
loggedInUserId,
hasGGCode,
loginEmailStr,
loggedInUserEmail,
ggLocale,
hasLoginCode,
noticeContent,
} = props;
@@ -74,9 +65,7 @@ const Home = (props) => {
}),
router.replace({
pathname:
router.locale == "cy" || ggLocale == "cy"
? "/cy/fymhorth"
: "/myportal",
router.locale == "cy" ? "/cy/fymhorth" : "/myportal",
}))
: console.log("no value in user id");
@@ -156,16 +145,8 @@ const Home = (props) => {
<div className="govuk-width-container">
{hasLoginCode ? (
<>
<h1>
{ggLocale == "cy"
? "Mewngofnodi"
: "Logging in"}
</h1>
<h2>
{ggLocale == "cy"
? "Arhoswch os gwelwch yn dda..."
: "Please wait..."}
</h2>
<h1>{t("home:logging-in-heading")}</h1>
<h2>{t("home:logging-in-paragraph")}</h2>
</>
) : (
<>
@@ -174,13 +155,10 @@ const Home = (props) => {
<NoticeBanner noticeContent={noticeContent} />
)}
<Main
ggLocale={ggLocale}
pages={pages}
showLogin={showLogin}
showMap={showMap}
loggedInUserId={loggedInUserId}
// GG_REDIRECT_URI={props.GG_REDIRECT_URI}
// GG_CLIENT_ID={props.GG_CLIENT_ID}
/>
</>
)}
@@ -200,7 +178,7 @@ export const getServerSideProps = wrapper.getServerSideProps(
var relayToken = await getToken();
relayToken = relayToken.access_token;
console.log("\n///////////////\nauth sess:", thisSession);
console.log("\n////////////////////\nauth sess:", thisSession);
const showLoginCheck = process.env.SHOWLOGIN || false;
const showMapCheck = process.env.SHOWMAPS || false;
@@ -209,13 +187,10 @@ export const getServerSideProps = wrapper.getServerSideProps(
console.log("server side has session:", thisSession != null);
// let providerConfig = await getProviderConfig();
let ggLocale =
typeof query.ui_locales != "undefined" && query.ui_locales;
console.log("hasloginCode:", hasLoginCode);
// store.dispatch(getGovGatewayConfig(providerConfig));
console.log("hasloginCode:", hasLoginCode + "\n////////////////////\n");
const noticeContent = await getNotice();
@@ -228,50 +203,22 @@ export const getServerSideProps = wrapper.getServerSideProps(
loginEmailStr = hashString(thisSession.user.email);
store.dispatch(setContainerID(thisSession.user.id));
portalUserObj = await getPortalLogin(
thisSession.user.email,
relayToken
);
portalUserObj = await getPortalLogin(thisSession.user.email);
} else {
console.log("///////////////\nempty session \n///////////////\n");
}
if (_.has(portalUserObj, "status") != false) {
if (portalUserObj.status == 400) {
return {
redirect: {
//destination: "/dns-not-found",
destination: "/error",
permanent: false,
},
};
} else {
console.log("loggin user stuff: ", portalUserObj);
store.dispatch(setAccountDetails(portalUserObj));
}
}
} else {
console.log("empty session");
}
console.log("///////////////\n");
if (ggToken.status == 400) {
return {
redirect: {
destination: "/myportal/error",
permanent: false,
},
};
} else {
return {
props: {
ggLocale: ggLocale,
showLogin: showLoginCheck,
showMap: showMapCheck,
hasSession: hasLoginCode,
loggedInUserId: portalUserObj,
loggedInUserEmail: loginEmailStr,
hasLoginCode: hasLoginCode,
noticeContent: noticeContent,
},
};
}
return {
props: {
showLogin: showLoginCheck,
showMap: showMapCheck,
hasSession: hasLoginCode,
loggedInUserId: portalUserObj,
loggedInUserEmail: loginEmailStr,
hasLoginCode: hasLoginCode,
noticeContent: noticeContent,
},
};
}
);
@@ -287,7 +234,6 @@ const mapStateToProps = (state) => {
watchedCases: state.watchedCases,
myRepresentations: state.myRepresentations,
awaitingSubmission: state.awaitingSubmission,
govGateway: state.govGateway,
};
};
export default connect(mapStateToProps)(Home);