added signin workaround for dev

This commit is contained in:
2023-07-27 14:05:45 +01:00
parent daa8b1c96d
commit dcf220198d
4 changed files with 31 additions and 24 deletions
+4 -4
View File
@@ -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"; 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; break;
case "pinswg_planningappeals78s": case "pinswg_planningappeals78s":
console.log( // console.log(
"///////////////\n path:", // "///////////////\n path:",
process.env.RELAYPATH == "test-pedw-hc" // process.env.RELAYPATH == "test-pedw-hc"
); // );
return process.env.RELAYPATH == "dev-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_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"; : "&$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";
+7 -5
View File
@@ -141,15 +141,17 @@ const authOptions = (locale, req) => {
const templateId = "b1b5704b-9bb8-4deb-a75c-d887ca902661"; const templateId = "b1b5704b-9bb8-4deb-a75c-d887ca902661";
const templateIdcy = "0614ce53-cd5f-421f-a1a5-8c8486a9113a"; const templateIdcy = "0614ce53-cd5f-421f-a1a5-8c8486a9113a";
const emailAddress = email; const emailAddress = email;
console.log("verifciation url", url); console.log(
"============================================================\n",
"verificiation url: " + url + "\n",
"============================================================\n"
);
let newURL = let newURL =
locale == "cy" locale == "cy"
? process.env.CY_API_ROOT ? process.env.CY_API_ROOT
: process.env.NEXTAUTH_URL; : process.env.NEXTAUTH_URL;
const csrfToken = await getCsrfToken({ req }); //console.log(newURL, searchParams.get("token"));
console.log(newURL, searchParams.get("token"));
const personalisation = { const personalisation = {
"emailAddress": email, "emailAddress": email,
"signInLink": url, "signInLink": url,
@@ -227,7 +229,7 @@ const authOptions = (locale, req) => {
locale == "cy" locale == "cy"
? process.env.CY_API_ROOT ? process.env.CY_API_ROOT
: process.env.NEXTAUTH_URL; : process.env.NEXTAUTH_URL;
console.log("baseurl:", newURL); //console.log("baseurl:", newURL);
//return baseUrl; //return baseUrl;
return newURL; return newURL;
}, },
+3 -3
View File
@@ -91,8 +91,8 @@ const SignIn = (props) => {
}; };
export async function getServerSideProps(context) { export async function getServerSideProps(context) {
console.log("-1-1-1-1-", context.query.callbackUrl, context.locale); //console.log("-1-1-1-1-", context.query.callbackUrl, context.locale);
console.log("------ " + context.query.callbackUrl); //console.log("------ " + context.query.callbackUrl);
// setCookie(context, "next-auth.callback-url", context.query.callbackUrl, { // setCookie(context, "next-auth.callback-url", context.query.callbackUrl, {
// path: "/", // path: "/",
// }); // });
@@ -113,7 +113,7 @@ export async function getServerSideProps(context) {
new URL(callback).port; // + new URL(callback).port; // +
// "/api/auth/signin/email"; // "/api/auth/signin/email";
console.log("******", formURL, callback, csrfToken); //console.log("******", formURL, callback, csrfToken);
return { return {
props: { csrfToken: csrfToken, callbackUrl: formURL, redirect: true }, props: { csrfToken: csrfToken, callbackUrl: formURL, redirect: true },
}; };
+17 -12
View File
@@ -188,7 +188,7 @@ export const getServerSideProps = wrapper.getServerSideProps(
const accountDetails = await getPersonalAccount(loggedInUser); const accountDetails = await getPersonalAccount(loggedInUser);
console.log("----------", accountDetails); //console.log("----------", accountDetails);
const lpaid = const lpaid =
accountDetails[ accountDetails[
@@ -300,7 +300,7 @@ const getDetails = (resultsObj, detailsType) => {
resultsObj = resultsObj.value; resultsObj = resultsObj.value;
if (detailsType == "myRepresentations") { if (detailsType == "myRepresentations") {
const repsObj = resultsObj.map((searchDetail, index) => { const repsObj = resultsObj.map((searchDetail, index) => {
console.log(".......... ", searchDetail); //console.log(".......... ", searchDetail);
detailsArr.push( detailsArr.push(
getCase(searchDetail["incidentID"]).then((data) => { getCase(searchDetail["incidentID"]).then((data) => {
let caseID = ""; let caseID = "";
@@ -360,17 +360,22 @@ const getDetails = (resultsObj, detailsType) => {
//console.log(detailsType, " case id : ", caseID); //console.log(detailsType, " case id : ", caseID);
if (searchDetail.pinswg_appealcasetype == null) { 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( console.log(
"detailsObj:", "=====================================\n",
detailsType, detailsType + "\n",
detailsType == "myCases" && searchDetail.pinswg_title, "=====================================\n"
detailsType == "myWatchedCases" &&
searchDetail[
"_pinswg_watchedcase_value@OData.Community.Display.V1.FormattedValue"
],
detailsType == "awaitingSubmission" &&
searchDetail.ticketnumber,
detailsType == "myRepresentations" && searchDetail.casereference
); );
} else { } else {
detailsArr.push( detailsArr.push(