updated storage account stuff to take auth id
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import useTranslation from "next-translate/useTranslation";
|
||||
import Head from "next/head";
|
||||
import { getSession, useSession } from "next-auth/react";
|
||||
import _ from "lodash";
|
||||
|
||||
import { useRouter } from "next/router";
|
||||
import { connect } from "react-redux";
|
||||
@@ -16,6 +17,7 @@ import Header from "../../components/header";
|
||||
import CreateCase from "../../components/newappeal/createCase";
|
||||
import {
|
||||
setAccountDetails,
|
||||
setContainerID,
|
||||
setLoggedInUserId,
|
||||
} from "../../store/accountDetails/action";
|
||||
import { setAppealType } from "../../store/appealType/action";
|
||||
@@ -120,7 +122,7 @@ const Home = (props) => {
|
||||
appealType={props.setAppealType}
|
||||
loggedInUser={props.accountDetails.loggedinUserId}
|
||||
whichForm={props.form}
|
||||
loggedInUserIdent={loggedInUserIdent}
|
||||
containerID={props.accountDetails.containerID}
|
||||
/>
|
||||
</main>
|
||||
</div>
|
||||
@@ -141,6 +143,14 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
||||
let thisSession = await getSession(ctx);
|
||||
console.log("nextAuth Session:", thisSession);
|
||||
|
||||
if (_.has(thisSession, "user") == false) {
|
||||
return {
|
||||
redirect: {
|
||||
destination: "/error",
|
||||
permanent: false,
|
||||
},
|
||||
};
|
||||
}
|
||||
let loggedInUserIdent = thisSession.user.id;
|
||||
let loggedInUser = cookies.pinsUser;
|
||||
|
||||
@@ -163,6 +173,7 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
||||
store.dispatch(setLPA(lpaData));
|
||||
store.dispatch(setLoggedInUserId(loggedInUser));
|
||||
store.dispatch(setAccountDetails(accountDetails));
|
||||
store.dispatch(setContainerID(thisSession.user.id));
|
||||
|
||||
return {
|
||||
props: { loggedInUserIdent: loggedInUserIdent },
|
||||
|
||||
Reference in New Issue
Block a user