show login boolean in redux store
This commit is contained in:
+52
-48
@@ -292,60 +292,64 @@ const CaseSummary = (props) => {
|
|||||||
</dl>
|
</dl>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="govuk-grid-row">
|
{(props.currentView.showLogin == true ||
|
||||||
<div className="govuk-grid-column-full">
|
props.currentView.showLogin == "true") && (
|
||||||
<div className="govuk-button-group">
|
<div className="govuk-grid-row">
|
||||||
{props.currentView.showReps == true ||
|
<div className="govuk-grid-column-full">
|
||||||
(props.currentView.showReps == "true" &&
|
<div className="govuk-button-group">
|
||||||
_.has(detailsObj, "pinswg_startdate") &&
|
{props.currentView.showReps == true ||
|
||||||
hasEndDate &&
|
(props.currentView.showReps == "true" &&
|
||||||
showReps(
|
_.has(detailsObj, "pinswg_startdate") &&
|
||||||
detailsObj.pinswg_startdate,
|
hasEndDate &&
|
||||||
detailsObj.pinswg_representation_period_end_date
|
showReps(
|
||||||
) && (
|
detailsObj.pinswg_startdate,
|
||||||
<>
|
detailsObj.pinswg_representation_period_end_date
|
||||||
<Link
|
) && (
|
||||||
href={{
|
<>
|
||||||
pathname:
|
<Link
|
||||||
"/myportal/representation",
|
href={{
|
||||||
query: {
|
pathname:
|
||||||
case:
|
"/myportal/representation",
|
||||||
currentType ==
|
query: {
|
||||||
"searchResultsObj"
|
case:
|
||||||
? detailsObj.pinswg_name
|
currentType ==
|
||||||
: casesObj.reference,
|
"searchResultsObj"
|
||||||
},
|
? detailsObj.pinswg_name
|
||||||
}}
|
: casesObj.reference,
|
||||||
>
|
},
|
||||||
<a className="govuk-button">
|
}}
|
||||||
|
>
|
||||||
|
<a className="govuk-button">
|
||||||
|
{t(
|
||||||
|
"case:summary-make-representation-label"
|
||||||
|
)}
|
||||||
|
</a>
|
||||||
|
</Link>
|
||||||
|
<a
|
||||||
|
onClick={() => {
|
||||||
|
//spinnerState();
|
||||||
|
router.back();
|
||||||
|
}}
|
||||||
|
className="govuk-button govuk-button--secondary"
|
||||||
|
>
|
||||||
{t(
|
{t(
|
||||||
"case:summary-make-representation-label"
|
"case:summary-back-button-label"
|
||||||
)}
|
)}
|
||||||
</a>
|
</a>
|
||||||
</Link>
|
</>
|
||||||
<a
|
))}
|
||||||
onClick={() => {
|
<div className="govuk-body">
|
||||||
//spinnerState();
|
<Link href="">
|
||||||
router.back();
|
<a className="govuk-link">
|
||||||
}}
|
Watch this case
|
||||||
className="govuk-button govuk-button--secondary"
|
</a>
|
||||||
>
|
</Link>
|
||||||
{t(
|
</div>
|
||||||
"case:summary-back-button-label"
|
|
||||||
)}
|
|
||||||
</a>
|
|
||||||
</>
|
|
||||||
))}
|
|
||||||
<div className="govuk-body">
|
|
||||||
<Link href="">
|
|
||||||
<a className="govuk-link">
|
|
||||||
Watch this case
|
|
||||||
</a>
|
|
||||||
</Link>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>{" "}
|
)}
|
||||||
|
|
||||||
<div className="govuk-grid-row">
|
<div className="govuk-grid-row">
|
||||||
<div className="govuk-grid-column-full">
|
<div className="govuk-grid-column-full">
|
||||||
{props.currentView.showReps == true ||
|
{props.currentView.showReps == true ||
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import {
|
|||||||
setAccountDetails,
|
setAccountDetails,
|
||||||
setContainerID,
|
setContainerID,
|
||||||
} from "../store/accountDetails/action";
|
} from "../store/accountDetails/action";
|
||||||
|
import { setShowReps } from "../store/currentView/action";
|
||||||
import { wrapper } from "../store/store";
|
import { wrapper } from "../store/store";
|
||||||
import { getSession, useSession, signIn, signOut } from "next-auth/react";
|
import { getSession, useSession, signIn, signOut } from "next-auth/react";
|
||||||
|
|
||||||
@@ -159,7 +160,10 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
|||||||
|
|
||||||
const showLoginCheck = process.env.SHOWLOGIN || false;
|
const showLoginCheck = process.env.SHOWLOGIN || false;
|
||||||
const showMapCheck = process.env.SHOWMAPS || false;
|
const showMapCheck = process.env.SHOWMAPS || false;
|
||||||
|
const showReps = process.env.SHOWREPRESENTATIONS || false;
|
||||||
|
store.dispatch(setShowReps(showReps, showLoginCheck));
|
||||||
|
|
||||||
|
console.log("server checks :", showReps, showLoginCheck);
|
||||||
let hasLoginCode = thisSession != null;
|
let hasLoginCode = thisSession != null;
|
||||||
|
|
||||||
console.log("server side has session:", thisSession != null);
|
console.log("server side has session:", thisSession != null);
|
||||||
|
|||||||
@@ -90,9 +90,11 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
const showReps = process.env.SHOWREPRESENTATIONS || false;
|
const showReps = process.env.SHOWREPRESENTATIONS || false;
|
||||||
|
const showLoginCheck = process.env.SHOWLOGIN || false;
|
||||||
|
store.dispatch(setShowReps(showReps, showLoginCheck));
|
||||||
|
|
||||||
console.log("env var ", process.env.SHOWREPRESENTATIONS);
|
console.log("env var ", process.env.SHOWREPRESENTATIONS);
|
||||||
store.dispatch(setShowReps(showReps));
|
store.dispatch(setShowReps(showReps, showLoginCheck));
|
||||||
|
|
||||||
searchResultsObj =
|
searchResultsObj =
|
||||||
searchResultsObj.status == 502
|
searchResultsObj.status == 502
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ export const currentViewActionTypes = {
|
|||||||
SETSHOWREPS: "SETSHOWREPS",
|
SETSHOWREPS: "SETSHOWREPS",
|
||||||
SETREPRESENTATIONMESSAGESENT: "SETREPRESENTATIONMESSAGESENT",
|
SETREPRESENTATIONMESSAGESENT: "SETREPRESENTATIONMESSAGESENT",
|
||||||
SETREPRESENTATIONRESET: "SETREPRESENTATIONRESET",
|
SETREPRESENTATIONRESET: "SETREPRESENTATIONRESET",
|
||||||
|
SETSHOWLOGIN: "SETSHOWLOGIN",
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getCurrentViewObj = () => (dispatch) => {
|
export const getCurrentViewObj = () => (dispatch) => {
|
||||||
@@ -94,9 +95,10 @@ export const setCurrentPage = (currentPage) => (dispatch) => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export const setShowReps = (showReps) => (dispatch) => {
|
export const setShowReps = (showReps, showLogin) => (dispatch) => {
|
||||||
return dispatch({
|
return dispatch({
|
||||||
type: currentViewActionTypes.SETSHOWREPS,
|
type: currentViewActionTypes.SETSHOWREPS,
|
||||||
|
showLogin: showLogin,
|
||||||
showReps: showReps,
|
showReps: showReps,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ const currentViewInitialState = {
|
|||||||
linkedCaseReferences: {},
|
linkedCaseReferences: {},
|
||||||
currentPage: 1,
|
currentPage: 1,
|
||||||
showReps: false,
|
showReps: false,
|
||||||
|
showLogin: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
export default function reducer(state = currentViewInitialState, action) {
|
export default function reducer(state = currentViewInitialState, action) {
|
||||||
@@ -69,6 +70,7 @@ export default function reducer(state = currentViewInitialState, action) {
|
|||||||
return {
|
return {
|
||||||
...state,
|
...state,
|
||||||
showReps: action.showReps,
|
showReps: action.showReps,
|
||||||
|
showLogin: action.showLogin,
|
||||||
};
|
};
|
||||||
default:
|
default:
|
||||||
return state;
|
return state;
|
||||||
|
|||||||
+1
-1
@@ -137,7 +137,7 @@ const makeStore = ({ isServer }) => {
|
|||||||
"watchedCases",
|
"watchedCases",
|
||||||
"form",
|
"form",
|
||||||
],
|
],
|
||||||
version: 2,
|
version: 3,
|
||||||
storage: storage,
|
storage: storage,
|
||||||
stateReconciler: autoMergeLevel2, // if needed, use a safer storage
|
stateReconciler: autoMergeLevel2, // if needed, use a safer storage
|
||||||
migrate: createMigrate(migrations, { debug: true }),
|
migrate: createMigrate(migrations, { debug: true }),
|
||||||
|
|||||||
Reference in New Issue
Block a user