updated storage account stuff to take auth id
This commit is contained in:
+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