duplicate contacts catch and handle and welsh
This commit is contained in:
@@ -43,9 +43,9 @@ export default async function ApiProxy(req, res) {
|
||||
var queryUrl =
|
||||
"contacts?$filter=emailaddress1 eq '" +
|
||||
emailAddress +
|
||||
"'&$count=true&$select=emailaddress1,contactid,yomifullname,firstname,lastname";
|
||||
"' and statuscode eq 1&$count=true&$select=emailaddress1,contactid,yomifullname,firstname,lastname";
|
||||
|
||||
//console.log(req.query);
|
||||
console.log(req.query, queryUrl);
|
||||
|
||||
var apiResponse = _.isEmpty(req.query)
|
||||
? res.status(400).json()
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
// 404.js
|
||||
import useTranslation from "next-translate/useTranslation";
|
||||
import Head from "next/head";
|
||||
import Link from "next/link";
|
||||
import CookieBanner from "../components/cookieBanner";
|
||||
import Footer from "../components/footer";
|
||||
import Header from "../components/header";
|
||||
import { parseCookies, setCookie, destroyCookie } from "nookies";
|
||||
import { useSession, signIn, signOut } from "next-auth/react";
|
||||
|
||||
const FourOhFour = (props) => {
|
||||
let { t, lang } = useTranslation();
|
||||
const { footerLinks, pages } = props;
|
||||
|
||||
const handleLogout = () => {
|
||||
console.info("////////////\n" + "logout" + "\n////////////");
|
||||
window.localStorage.clear(),
|
||||
destroyCookie(null, "next-auth.csrf-token"),
|
||||
destroyCookie(null, "next-auth.callback-url"),
|
||||
destroyCookie(null, "pedw_locale"),
|
||||
destroyCookie(null, "pinsUser"),
|
||||
signOut({ callbackUrl: "/" });
|
||||
};
|
||||
|
||||
return (
|
||||
<div>
|
||||
<Head>
|
||||
<title>
|
||||
{t("common:further-details-title")} -{" "}
|
||||
{t("common:service-name")}
|
||||
</title>
|
||||
</Head>
|
||||
<div id="page_wrapper">
|
||||
<CookieBanner />
|
||||
<Header courseName={t("common:service-name")} />
|
||||
<div className="govuk-width-container govuk-!-padding-bottom-9">
|
||||
<main className="govuk-main-wrapper govuk-!-padding-top-9 govuk-!-padding-bottom-9">
|
||||
<div className="govuk-grid-row">
|
||||
<div className="govuk-grid-column-full ">
|
||||
<h1>{t("common:further-details-header")}</h1>
|
||||
<p className="govuk-body">
|
||||
{t("common:further-details-para-one")}
|
||||
</p>
|
||||
|
||||
<p className="govuk-body">
|
||||
{t("common:further-details-para-two")}{" "}
|
||||
<Link
|
||||
href={
|
||||
"mailto:" +
|
||||
t("home:login-contact-email")
|
||||
}
|
||||
>
|
||||
{t("home:login-contact-email")}
|
||||
</Link>{" "}
|
||||
</p>
|
||||
<Link href="/" onClick={handleLogout}>
|
||||
{t("common:404-not-found-link")}
|
||||
</Link>
|
||||
</div>
|
||||
</div>
|
||||
</main>
|
||||
</div>
|
||||
<Footer footerLinks={footerLinks} ticketnumber={props} />
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default FourOhFour;
|
||||
@@ -191,6 +191,25 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
||||
await getPortalLogin(thisSession.user.email),
|
||||
]);
|
||||
|
||||
//grabs first contact on this list
|
||||
|
||||
//jump out page for duplicates....
|
||||
|
||||
console.log(
|
||||
"Number of contacts with this email:",
|
||||
loggedInUser.value.length
|
||||
);
|
||||
if (loggedInUser.value.length > 1) {
|
||||
return {
|
||||
redirect: {
|
||||
destination:
|
||||
ctx.locale == "cy"
|
||||
? "/cy/manylionpellach"
|
||||
: "/furtherdetails",
|
||||
permanent: false,
|
||||
},
|
||||
};
|
||||
}
|
||||
loggedInUser = loggedInUser.value[0].contactid;
|
||||
//console.log("nextAuth Session:", thisSession);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user