updated storage account stuff to take auth id
This commit is contained in:
@@ -7,12 +7,12 @@ import { useEffect } from "react";
|
||||
import { connect } from "react-redux";
|
||||
import xpath from "xpath";
|
||||
import {
|
||||
createCase,
|
||||
getCase,
|
||||
getAppealsTypes,
|
||||
getMandatoryFields,
|
||||
getPickLists,
|
||||
getFilesFromBlob,
|
||||
getProgressFromBlob,
|
||||
} from "../../actions";
|
||||
import { getProviderConfig } from "../../actions/govgateway";
|
||||
import Breadcrumbs from "../../components/breadcrumbs";
|
||||
@@ -24,7 +24,10 @@ import BuildSection from "../../components/newappeal/buildsection";
|
||||
import CompleteAppeal from "../../components/newappeal/complete";
|
||||
import TimeOut from "../../components/timeout";
|
||||
|
||||
import { setLoggedInUserId } from "../../store/accountDetails/action";
|
||||
import {
|
||||
setLoggedInUserId,
|
||||
setContainerID,
|
||||
} from "../../store/accountDetails/action";
|
||||
import {
|
||||
setAppealLPA,
|
||||
setAppealType,
|
||||
@@ -36,6 +39,8 @@ import {
|
||||
import { setForm } from "../../store/formData/action";
|
||||
import { getGovGatewayConfig } from "../../store/govgateway/action";
|
||||
import { wrapper } from "../../store/store";
|
||||
import { getProgressBlobs } from "../../actions/azurestorage";
|
||||
import { getSession, useSession } from "next-auth/react";
|
||||
|
||||
let Home = (props) => {
|
||||
const { footerLinks, pages, formData } = props;
|
||||
@@ -217,17 +222,27 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
||||
console.log("ref:", query.id);
|
||||
let loggedInUser = cookies.pinsUser;
|
||||
|
||||
let thisSession = await getSession(ctx);
|
||||
console.log("nextAuth Session:", thisSession);
|
||||
|
||||
let loggedInUserIdent = thisSession.user.id;
|
||||
|
||||
console.log("logged ident:", loggedInUserIdent);
|
||||
|
||||
const [
|
||||
caseReferenceData,
|
||||
appealTypeData,
|
||||
mandatoryFieldsData,
|
||||
pickListData,
|
||||
//blobList,
|
||||
blobProgress,
|
||||
] = await Promise.all([
|
||||
await getCase(query.id),
|
||||
await getAppealsTypes(),
|
||||
await getMandatoryFields(query.appealtypes),
|
||||
await getPickLists(query.appealtypes),
|
||||
await getProgressFromBlob(loggedInUserIdent, query.casereference),
|
||||
|
||||
//await getFilesFromBlob(query.casereference),
|
||||
]);
|
||||
|
||||
@@ -255,6 +270,8 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
||||
store.dispatch(setCaseReference(caseReference));
|
||||
store.dispatch(setForm(xmlStr, mandatoryFieldsData, pickListData));
|
||||
store.dispatch(setAppealType(appealTypeData));
|
||||
store.dispatch(setContainerID(thisSession.user.id));
|
||||
|
||||
//store.dispatch(setFilesForAppeal(blobList));
|
||||
}
|
||||
);
|
||||
|
||||
@@ -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