diff --git a/actions/index.js b/actions/index.js index c5507837..4abdb165 100644 --- a/actions/index.js +++ b/actions/index.js @@ -894,8 +894,7 @@ export const getPortalModuleDetailsProxy = (appealType, caseReference) => { export const getEmailAccountCheck = (emailAddress) => { return axios .get( - BASE_URL + - "/api/endpoint/getemailaccountcheck_api?emailAddress=" + + "/api/endpoint/getemailaccountcheck_api?emailAddress=" + emailAddress ) .then((res) => res.data) diff --git a/components/account/registerComplete.js b/components/account/registerComplete.js index fb82290e..a0c42acb 100644 --- a/components/account/registerComplete.js +++ b/components/account/registerComplete.js @@ -21,6 +21,8 @@ import { } from "react-redux"; import { setAccCr, setLogout } from "../../store/accountDetails/action"; +import { useSession, signIn, signOut } from "next-auth/react"; +import { parseCookies, setCookie, destroyCookie } from "nookies"; import { getEmailAccountCheck, createAccount } from "../../actions"; @@ -53,6 +55,7 @@ const RegisterComplete = (props) => { let checkEmailObj = {}; + console.log("props.accountDetails.accCr :", props.accountDetails.accCr); switch (props.accountDetails.accCr) { case "created": case "exists": @@ -78,7 +81,7 @@ const RegisterComplete = (props) => { var registerBody = ""; switch (props.accountDetails.accCr) { case "created": - return registerBody = ( + return (registerBody = ( <>

{t("account:register-new-account-confirmation-email")} @@ -98,30 +101,28 @@ const RegisterComplete = (props) => { { - setLogout(), - window.localStorage.clear(), - destroyCookie( - null, - "next-auth.csrf-token" - ), - destroyCookie( - null, - "next-auth.callback-url" - ), - destroyCookie(null, "pedw_locale"), - destroyCookie(null, "pinsUser"), - signOut({ callbackUrl: "/logout" }); - }}> - - {t( - "account:register-new-account-my-portal-link" - )} - + // onClick={() => { + // 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: "/logout" }); + // }} + > + {t("account:register-new-account-my-portal-link")}

- ); + )); break; diff --git a/pages/api/auth/[...nextauth].js b/pages/api/auth/[...nextauth].js index dfc3a835..c4699831 100644 --- a/pages/api/auth/[...nextauth].js +++ b/pages/api/auth/[...nextauth].js @@ -223,7 +223,7 @@ const authOptions = (locale, req, res) => { error: (locale == "cy" ? "/cy" : "") + "/auth/error", // Error code passed in query string as ?error= verifyRequest: (locale == "cy" ? "/cy" : "") + "/auth/verify-request", // (used for check email message) - newUser: locale + "/account/register", // New users will be directed here on first sign in (leave the property out if not of interest) + newUser: (locale == "cy" ? "/cy" : "") + "/account/register", // New users will be directed here on first sign in (leave the property out if not of interest) }, callbacks: { session: async (session, user) => {