show login boolean in redux store

This commit is contained in:
2023-02-15 08:34:04 +00:00
parent 316e66a96f
commit fc5217daf8
6 changed files with 65 additions and 51 deletions
+5 -1
View File
@@ -292,6 +292,8 @@ const CaseSummary = (props) => {
</dl>
</div>
</div>
{(props.currentView.showLogin == true ||
props.currentView.showLogin == "true") && (
<div className="govuk-grid-row">
<div className="govuk-grid-column-full">
<div className="govuk-button-group">
@@ -345,7 +347,9 @@ const CaseSummary = (props) => {
</div>
</div>
</div>
</div>{" "}
</div>
)}
<div className="govuk-grid-row">
<div className="govuk-grid-column-full">
{props.currentView.showReps == true ||
+4
View File
@@ -14,6 +14,7 @@ import {
setAccountDetails,
setContainerID,
} from "../store/accountDetails/action";
import { setShowReps } from "../store/currentView/action";
import { wrapper } from "../store/store";
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 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;
console.log("server side has session:", thisSession != null);
+3 -1
View File
@@ -90,9 +90,11 @@ export const getServerSideProps = wrapper.getServerSideProps(
]);
const showReps = process.env.SHOWREPRESENTATIONS || false;
const showLoginCheck = process.env.SHOWLOGIN || false;
store.dispatch(setShowReps(showReps, showLoginCheck));
console.log("env var ", process.env.SHOWREPRESENTATIONS);
store.dispatch(setShowReps(showReps));
store.dispatch(setShowReps(showReps, showLoginCheck));
searchResultsObj =
searchResultsObj.status == 502
+3 -1
View File
@@ -10,6 +10,7 @@ export const currentViewActionTypes = {
SETSHOWREPS: "SETSHOWREPS",
SETREPRESENTATIONMESSAGESENT: "SETREPRESENTATIONMESSAGESENT",
SETREPRESENTATIONRESET: "SETREPRESENTATIONRESET",
SETSHOWLOGIN: "SETSHOWLOGIN",
};
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({
type: currentViewActionTypes.SETSHOWREPS,
showLogin: showLogin,
showReps: showReps,
});
};
+2
View File
@@ -10,6 +10,7 @@ const currentViewInitialState = {
linkedCaseReferences: {},
currentPage: 1,
showReps: false,
showLogin: false,
};
export default function reducer(state = currentViewInitialState, action) {
@@ -69,6 +70,7 @@ export default function reducer(state = currentViewInitialState, action) {
return {
...state,
showReps: action.showReps,
showLogin: action.showLogin,
};
default:
return state;
+1 -1
View File
@@ -137,7 +137,7 @@ const makeStore = ({ isServer }) => {
"watchedCases",
"form",
],
version: 2,
version: 3,
storage: storage,
stateReconciler: autoMergeLevel2, // if needed, use a safer storage
migrate: createMigrate(migrations, { debug: true }),