From dcf220198d3ebffd8955d859e8a3c47dc69f5319 Mon Sep 17 00:00:00 2001 From: rdbsolutions Date: Thu, 27 Jul 2023 14:05:45 +0100 Subject: [PATCH] added signin workaround for dev --- actions/selectQueryTypes.js | 8 ++++---- pages/api/auth/[...nextauth].js | 12 +++++++----- pages/auth/signin.js | 6 +++--- pages/myportal/index.js | 29 +++++++++++++++++------------ 4 files changed, 31 insertions(+), 24 deletions(-) diff --git a/actions/selectQueryTypes.js b/actions/selectQueryTypes.js index 9f7cc22b..abcfd86b 100644 --- a/actions/selectQueryTypes.js +++ b/actions/selectQueryTypes.js @@ -48,10 +48,10 @@ export const getSelectQuery = (appealTypeName) => { return "&$select=_pinswg_appellant_value,pinswg_name,pinswg_siteaddressline1,pinswg_siteaddressline2,pinswg_sitepostcode,pinswg_siteaddresstown,_pinswg_associatedlpa_value,pinswg_casedecisiondate,pinswg_dateeventrequested,pinswg_decision,pinswg_finalcommentsduedate,pinswg_otherpartiesstatement,pinswg_procedure,pinswg_questionnaireduedate,pinswg_startdate,pinswg_statementduedate,statuscode,pinswg_starttimeofevent,pinswg_typeofevent"; break; case "pinswg_planningappeals78s": - console.log( - "///////////////\n path:", - process.env.RELAYPATH == "test-pedw-hc" - ); + // console.log( + // "///////////////\n path:", + // process.env.RELAYPATH == "test-pedw-hc" + // ); return process.env.RELAYPATH == "dev-pedw-hc" ? "&$select=_pinswg_appellant_value,pinswg_name,pinswg_siteaddressline1,pinswg_siteaddressline2,pinswg_siteaddresspostcode,pinswg_siteaddresstown,_pinswg_localplanningauthority_value,pinswg_casedecisiondate,pinswg_dicision,pinswg_dateeventrequested,pinswg_finalcommentsduedate,pinswg_procedure,pinswg_questionnaireduedate,pinswg_startdate,pinswg_statementduedate,statuscode,pinswg_startdatetimeiftheevent,pinswg_representation_period_end_date,pinswg_extend_representation_date,pinswg_typeofevent" : "&$select=_pinswg_appellant_value,pinswg_name,pinswg_siteaddressline1,pinswg_siteaddressline2,pinswg_siteaddresspostcode,pinswg_siteaddresstown,_pinswg_localplanningauthority_value,pinswg_casedecisiondate,pinswg_dicision,pinswg_dateeventrequested,pinswg_finalcommentsduedate,pinswg_procedure,pinswg_questionnaireduedate,pinswg_startdate,pinswg_statementduedate,statuscode,pinswg_startdatetimeiftheevent,pinswg_typeofevent"; diff --git a/pages/api/auth/[...nextauth].js b/pages/api/auth/[...nextauth].js index 4d054064..b32ee5db 100644 --- a/pages/api/auth/[...nextauth].js +++ b/pages/api/auth/[...nextauth].js @@ -141,15 +141,17 @@ const authOptions = (locale, req) => { const templateId = "b1b5704b-9bb8-4deb-a75c-d887ca902661"; const templateIdcy = "0614ce53-cd5f-421f-a1a5-8c8486a9113a"; const emailAddress = email; - console.log("verifciation url", url); + console.log( + "============================================================\n", + "verificiation url: " + url + "\n", + "============================================================\n" + ); let newURL = locale == "cy" ? process.env.CY_API_ROOT : process.env.NEXTAUTH_URL; - const csrfToken = await getCsrfToken({ req }); - - console.log(newURL, searchParams.get("token")); + //console.log(newURL, searchParams.get("token")); const personalisation = { "emailAddress": email, "signInLink": url, @@ -227,7 +229,7 @@ const authOptions = (locale, req) => { locale == "cy" ? process.env.CY_API_ROOT : process.env.NEXTAUTH_URL; - console.log("baseurl:", newURL); + //console.log("baseurl:", newURL); //return baseUrl; return newURL; }, diff --git a/pages/auth/signin.js b/pages/auth/signin.js index 09429524..fecd8682 100644 --- a/pages/auth/signin.js +++ b/pages/auth/signin.js @@ -91,8 +91,8 @@ const SignIn = (props) => { }; export async function getServerSideProps(context) { - console.log("-1-1-1-1-", context.query.callbackUrl, context.locale); - console.log("------ " + context.query.callbackUrl); + //console.log("-1-1-1-1-", context.query.callbackUrl, context.locale); + //console.log("------ " + context.query.callbackUrl); // setCookie(context, "next-auth.callback-url", context.query.callbackUrl, { // path: "/", // }); @@ -113,7 +113,7 @@ export async function getServerSideProps(context) { new URL(callback).port; // + // "/api/auth/signin/email"; - console.log("******", formURL, callback, csrfToken); + //console.log("******", formURL, callback, csrfToken); return { props: { csrfToken: csrfToken, callbackUrl: formURL, redirect: true }, }; diff --git a/pages/myportal/index.js b/pages/myportal/index.js index 9839ea13..a5133b72 100644 --- a/pages/myportal/index.js +++ b/pages/myportal/index.js @@ -188,7 +188,7 @@ export const getServerSideProps = wrapper.getServerSideProps( const accountDetails = await getPersonalAccount(loggedInUser); - console.log("----------", accountDetails); + //console.log("----------", accountDetails); const lpaid = accountDetails[ @@ -300,7 +300,7 @@ const getDetails = (resultsObj, detailsType) => { resultsObj = resultsObj.value; if (detailsType == "myRepresentations") { const repsObj = resultsObj.map((searchDetail, index) => { - console.log(".......... ", searchDetail); + //console.log(".......... ", searchDetail); detailsArr.push( getCase(searchDetail["incidentID"]).then((data) => { let caseID = ""; @@ -360,17 +360,22 @@ const getDetails = (resultsObj, detailsType) => { //console.log(detailsType, " case id : ", caseID); if (searchDetail.pinswg_appealcasetype == null) { + // console.log( + // "detailsObj:", + // detailsType, + // detailsType == "myCases" && searchDetail.pinswg_title, + // detailsType == "myWatchedCases" && + // searchDetail[ + // "_pinswg_watchedcase_value@OData.Community.Display.V1.FormattedValue" + // ], + // detailsType == "awaitingSubmission" && + // searchDetail.ticketnumber, + // detailsType == "myRepresentations" && searchDetail.casereference + // ); console.log( - "detailsObj:", - detailsType, - detailsType == "myCases" && searchDetail.pinswg_title, - detailsType == "myWatchedCases" && - searchDetail[ - "_pinswg_watchedcase_value@OData.Community.Display.V1.FormattedValue" - ], - detailsType == "awaitingSubmission" && - searchDetail.ticketnumber, - detailsType == "myRepresentations" && searchDetail.casereference + "=====================================\n", + detailsType + "\n", + "=====================================\n" ); } else { detailsArr.push(