updated storage account stuff to take auth id
This commit is contained in:
@@ -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,
|
||||
@@ -38,6 +41,7 @@ import { getGovGatewayConfig } from "../../store/govgateway/action";
|
||||
import { wrapper } from "../../store/store";
|
||||
import { getPartSavedDetails } from "../../components/utils";
|
||||
import { getProgressBlobs } from "../../actions/azurestorage";
|
||||
import { getSession, useSession } from "next-auth/react";
|
||||
|
||||
let Home = (props) => {
|
||||
const { footerLinks, pages, formData } = props;
|
||||
@@ -217,6 +221,13 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
||||
console.log("the query", query.appealtypes);
|
||||
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 [
|
||||
appealTypeData,
|
||||
mandatoryFieldsData,
|
||||
@@ -227,11 +238,11 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
||||
await getAppealsTypes(),
|
||||
await getMandatoryFields(query.appealtypes),
|
||||
await getPickLists(query.appealtypes),
|
||||
await getFilesFromBlob(query.casereference),
|
||||
await getProgressFromBlob(query.casereference),
|
||||
await getFilesFromBlob(loggedInUserIdent, query.casereference),
|
||||
await getProgressFromBlob(loggedInUserIdent, query.casereference),
|
||||
]);
|
||||
|
||||
console.log("has blobprgess:", blobProgress);
|
||||
console.log("has blobprogess:", loggedInUserIdent, query.casereference);
|
||||
|
||||
//
|
||||
// Removed to make progress from Blob not CRM
|
||||
@@ -283,6 +294,7 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
||||
store.dispatch(setForm(xmlStr, mandatoryFieldsData, pickListData));
|
||||
store.dispatch(setAppealType(appealTypeData));
|
||||
store.dispatch(setFilesForAppeal(blobList));
|
||||
store.dispatch(setContainerID(thisSession.user.id));
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
+19
-1
@@ -12,6 +12,7 @@ import {
|
||||
getPortalModuleDetails,
|
||||
getWatchedCases,
|
||||
} from "../../actions";
|
||||
import { createContainer } from "../../actions/azurestorage";
|
||||
import { getProviderConfig } from "../../actions/govgateway";
|
||||
import Breadcrumbs from "../../components/breadcrumbs";
|
||||
import CookieBanner from "../../components/cookieBanner";
|
||||
@@ -21,6 +22,7 @@ import MyPortal from "../../components/myportal";
|
||||
import { getFormCollectionByID } from "../../components/utils";
|
||||
import {
|
||||
setAccountDetails,
|
||||
setContainerID,
|
||||
setLoggedInUserId,
|
||||
} from "../../store/accountDetails/action";
|
||||
import {
|
||||
@@ -161,6 +163,18 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
||||
|
||||
console.log("nextAuth Session:", thisSession);
|
||||
|
||||
if (_.has(thisSession, "user") == false) {
|
||||
return {
|
||||
redirect: {
|
||||
destination: "/error",
|
||||
permanent: false,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
//Create Storage container for logged in user
|
||||
await createContainer(thisSession.user.id);
|
||||
|
||||
let providerConfig = await getProviderConfig();
|
||||
|
||||
store.dispatch(getGovGatewayConfig(providerConfig));
|
||||
@@ -213,9 +227,13 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
||||
store.dispatch(
|
||||
setAwaitingSubmissionDetails(awaitingSubmissionDetails)
|
||||
);
|
||||
store.dispatch(setContainerID(thisSession.user.id));
|
||||
|
||||
return {
|
||||
props: { showFileUpload: process.env.SHOWFILEUPLOAD },
|
||||
props: {
|
||||
showFileUpload: process.env.SHOWFILEUPLOAD,
|
||||
containerID: thisSession.user.id,
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user