reps wip
This commit is contained in:
+1
-1
@@ -35,6 +35,7 @@ function Error({ statusCode }, props) {
|
||||
{t("common:error-instruction-label")}
|
||||
</p>
|
||||
<a
|
||||
href={session != null ? "#" : "/"}
|
||||
className="govuk-link"
|
||||
onClick={() => {
|
||||
window.localStorage.clear(),
|
||||
@@ -46,7 +47,6 @@ function Error({ statusCode }, props) {
|
||||
: Router.push("/");
|
||||
}}
|
||||
>
|
||||
{" "}
|
||||
Go back home
|
||||
</a>
|
||||
</div>
|
||||
|
||||
@@ -14,6 +14,8 @@ import {
|
||||
setSearchDetails,
|
||||
setSearchResults,
|
||||
} from "../store/searchOutput/action";
|
||||
import { setShowReps } from "../store/currentView/action";
|
||||
|
||||
import { wrapper } from "../store/store";
|
||||
|
||||
const Home = (props) => {
|
||||
@@ -118,6 +120,9 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
||||
const searchResultsObj = await getAdvancedSearch(query);
|
||||
const searchDetailsObj = await getSearchDetails(searchResultsObj);
|
||||
|
||||
const showReps = process.env.SHOWREPRESENTATIONS || false;
|
||||
store.dispatch(setShowReps(showReps));
|
||||
|
||||
store.dispatch(setSearchResults(searchResultsObj));
|
||||
store.dispatch(setSearchDetails(searchDetailsObj));
|
||||
store.dispatch(setSearch(Object.entries(query)));
|
||||
|
||||
@@ -39,7 +39,7 @@ export default async function ApiProxy(req, res) {
|
||||
var token = await getToken();
|
||||
|
||||
var queryUrl =
|
||||
"stringmaps?$filter=objecttypecode eq 'incident' and attributename eq 'pinswg_appealcasetype' and value ne 'LDP' and value ne 'Misc Casework'&$count=true&$select=value,stringmapid,organizationid,attributevalue&$orderby=value asc";
|
||||
"stringmaps?$filter=objecttypecode eq 'incident' and attributename eq 'pinswg_appealcasetype' and value ne 'Misc Casework'&$count=true&$select=value,stringmapid,organizationid,attributevalue&$orderby=value asc";
|
||||
//"stringmaps?$filter=objecttypecode eq 'incident' and attributename eq 'pinswg_appealcasetype' and value ne 'Developments of National Significance' and value ne 'LDP' and value ne 'Misc Casework'&$count=true&$select=value,stringmapid,organizationid,attributevalue&$orderby=value asc";
|
||||
|
||||
//console.log(queryUrl);
|
||||
|
||||
@@ -34,7 +34,7 @@ export default async function ApiProxy(req, res) {
|
||||
|
||||
queryUrl = queryUrl + getSelectQuery(appealTypeName);
|
||||
|
||||
//console.log("///////////\nquery: ", queryUrl, "<<<<end query");
|
||||
console.log("///////////\nquery: ", queryUrl, "<<<<end query");
|
||||
|
||||
return axios
|
||||
.get(
|
||||
|
||||
@@ -26,7 +26,7 @@ export default async function ApiProxy(req, res) {
|
||||
loggedInUserId +
|
||||
"&$count=true&$orderby=createdon desc";
|
||||
|
||||
//console.log(WEBAPI_URL + queryUrl + hashAPIPath(queryUrl));
|
||||
console.log(WEBAPI_URL + queryUrl + hashAPIPath(queryUrl));
|
||||
|
||||
return axios
|
||||
.get(
|
||||
|
||||
@@ -3,6 +3,7 @@ import {
|
||||
getContainers,
|
||||
getBlobs,
|
||||
createBlob,
|
||||
createRepBlob,
|
||||
uploadFile,
|
||||
} from "../../../actions/azurestorage";
|
||||
|
||||
@@ -21,6 +22,7 @@ ApiProxy.post(async (req, res) => {
|
||||
const appealData = req.body.appealData;
|
||||
const containerID = req.body.containerID[0];
|
||||
const casefolderID = req.body.casefolderID[0];
|
||||
const repOrAppeal = req.body.repOrAppeal || false;
|
||||
|
||||
console.log("there are files:", Object.keys(req.files).length);
|
||||
|
||||
@@ -33,10 +35,15 @@ ApiProxy.post(async (req, res) => {
|
||||
//createContainer(containerID).then((containerName) => {
|
||||
|
||||
console.log("does this get folder name:", containerID, casefolderID);
|
||||
createBlob(appealData, containerID, casefolderID).then((data) => {
|
||||
Object.keys(req.files).length > 0 &&
|
||||
uploadFile(req.files, containerID, casefolderID);
|
||||
});
|
||||
repOrAppeal
|
||||
? createRepBlob(appealData, containerID, casefolderID).then((data) => {
|
||||
Object.keys(req.files).length > 0 &&
|
||||
uploadFile(req.files, containerID, casefolderID);
|
||||
})
|
||||
: createBlob(appealData, containerID, casefolderID).then((data) => {
|
||||
Object.keys(req.files).length > 0 &&
|
||||
uploadFile(req.files, containerID, casefolderID);
|
||||
});
|
||||
//});
|
||||
|
||||
return res.status(200).json({ data: "success" });
|
||||
|
||||
@@ -88,6 +88,9 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
||||
store.dispatch(setAppealType(appealTypeData));
|
||||
store.dispatch(setLPA(lpaData));
|
||||
store.dispatch(setLoggedInUserId(loggedInUser));
|
||||
|
||||
thisSession != false &&
|
||||
store.dispatch(setContainerID(thisSession.user.id));
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ import {
|
||||
getAdvancedSearch,
|
||||
getPortalModuleDetails,
|
||||
getWatchedCases,
|
||||
getPersonalAccount,
|
||||
} from "../../actions";
|
||||
import Breadcrumbs from "../../components/breadcrumbs";
|
||||
import CookieBanner from "../../components/cookieBanner";
|
||||
@@ -20,6 +21,12 @@ import {
|
||||
setSearchDetails,
|
||||
setSearchResults,
|
||||
} from "../../store/searchOutput/action";
|
||||
|
||||
import {
|
||||
setAccountDetails,
|
||||
setContainerID,
|
||||
setLoggedInUserId,
|
||||
} from "../../store/accountDetails/action";
|
||||
import { setSearch } from "../../store/search/action";
|
||||
import { wrapper } from "../../store/store";
|
||||
import {
|
||||
@@ -27,6 +34,7 @@ import {
|
||||
setWatchedCasesDetails,
|
||||
} from "../../store/watchedCases/action";
|
||||
import TimeOut from "../../components/timeout";
|
||||
import { getSession, useSession, signIn, signOut } from "next-auth/react";
|
||||
|
||||
const Home = (props) => {
|
||||
const { footerLinks, pages, watchedCases } = props;
|
||||
@@ -64,30 +72,39 @@ const Home = (props) => {
|
||||
};
|
||||
|
||||
export const getServerSideProps = wrapper.getServerSideProps(
|
||||
(store) =>
|
||||
async ({ query, req, res }) => {
|
||||
console.log("query-", query);
|
||||
//console.log("search array:", Object.entries(query));
|
||||
const { cookies } = req;
|
||||
(store) => async (ctx) => {
|
||||
const { query, req, res } = ctx;
|
||||
console.log("query-", query);
|
||||
//console.log("search array:", Object.entries(query));
|
||||
const { cookies } = req;
|
||||
|
||||
let loggedInUser = cookies.pinsUser;
|
||||
let loggedInUser = cookies.pinsUser;
|
||||
let thisSession = await getSession(ctx);
|
||||
|
||||
const [searchResultsObj, watchedCases] = await Promise.all([
|
||||
thisSession != false &&
|
||||
store.dispatch(setContainerID(thisSession.user.id));
|
||||
|
||||
const [accountDetails, searchResultsObj, watchedCases] =
|
||||
await Promise.all([
|
||||
await getPersonalAccount(loggedInUser),
|
||||
await getAdvancedSearch(query),
|
||||
await getWatchedCases(loggedInUser),
|
||||
]);
|
||||
|
||||
const [searchDetailsObj, watchedCasesDetails] = await Promise.all([
|
||||
await getSearchDetails(searchResultsObj),
|
||||
await getDetails(watchedCases, "myWatchedCases"),
|
||||
]);
|
||||
console.log(accountDetails);
|
||||
|
||||
store.dispatch(setSearchResults(searchResultsObj));
|
||||
store.dispatch(setSearchDetails(searchDetailsObj));
|
||||
store.dispatch(setWatchedCases(watchedCases));
|
||||
store.dispatch(setWatchedCasesDetails(watchedCasesDetails));
|
||||
store.dispatch(setSearch(Object.entries(query)));
|
||||
}
|
||||
const [searchDetailsObj, watchedCasesDetails] = await Promise.all([
|
||||
await getSearchDetails(searchResultsObj),
|
||||
await getDetails(watchedCases, "myWatchedCases"),
|
||||
]);
|
||||
|
||||
store.dispatch(setAccountDetails(accountDetails));
|
||||
store.dispatch(setSearchResults(searchResultsObj));
|
||||
store.dispatch(setSearchDetails(searchDetailsObj));
|
||||
store.dispatch(setWatchedCases(watchedCases));
|
||||
store.dispatch(setWatchedCasesDetails(watchedCasesDetails));
|
||||
store.dispatch(setSearch(Object.entries(query)));
|
||||
}
|
||||
);
|
||||
|
||||
const getDetails = (resultsObj, detailsType) => {
|
||||
@@ -123,6 +140,7 @@ const getDetails = (resultsObj, detailsType) => {
|
||||
|
||||
const mapStateToProps = (state) => {
|
||||
return {
|
||||
accountDetails: state.accountDetails,
|
||||
currentView: state.currentView,
|
||||
search: state.search,
|
||||
searchResultsObj: state.searchResultsObj,
|
||||
|
||||
@@ -14,6 +14,7 @@ import {
|
||||
getWatchedCases,
|
||||
consoleLogger,
|
||||
getCase,
|
||||
getPortalLogin,
|
||||
} from "../../actions";
|
||||
import { createContainer } from "../../actions/azurestorage";
|
||||
import Breadcrumbs from "../../components/breadcrumbs";
|
||||
@@ -158,10 +159,15 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
||||
|
||||
const { cookies } = req;
|
||||
|
||||
let loggedInUser = cookies.pinsUser;
|
||||
let loggedInUserCookie = cookies.pinsUser;
|
||||
|
||||
let thisSession = await getSession(ctx);
|
||||
|
||||
let [loggedInUser] = await Promise.all([
|
||||
await getPortalLogin(thisSession.user.email),
|
||||
]);
|
||||
|
||||
loggedInUser = loggedInUser.value[0].contactid;
|
||||
console.log("nextAuth Session:", thisSession);
|
||||
|
||||
if (_.has(thisSession, "user") == false) {
|
||||
|
||||
@@ -99,6 +99,9 @@ const Home = (props) => {
|
||||
searchResultsObj={
|
||||
props.searchResultsObj.searchResultsObj
|
||||
}
|
||||
searchDetailsObj={
|
||||
props.searchResultsObj.searchDetailsObj
|
||||
}
|
||||
myRepresentations={
|
||||
props.myRepresentations.myRepresentations
|
||||
}
|
||||
|
||||
@@ -7,6 +7,8 @@ import {
|
||||
getBasicSearch,
|
||||
getPortalModuleDetails,
|
||||
getWatchedCases,
|
||||
consoleLogger,
|
||||
getPortalLogin,
|
||||
} from "../../actions";
|
||||
import Breadcrumbs from "../../components/breadcrumbs";
|
||||
import CookieBanner from "../../components/cookieBanner";
|
||||
@@ -76,13 +78,13 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
||||
|
||||
const { cookies } = req;
|
||||
|
||||
let loggedInUser = cookies.pinsUser;
|
||||
let loggedInUserCookie = cookies.pinsUser;
|
||||
|
||||
let thisSession = await getSession(ctx);
|
||||
|
||||
let [searchResultsObj, watchedCases] = await Promise.all([
|
||||
let [searchResultsObj, loggedInUser] = await Promise.all([
|
||||
await getBasicSearch(query.q),
|
||||
await getWatchedCases(loggedInUser),
|
||||
await getPortalLogin(thisSession.user.email),
|
||||
]);
|
||||
|
||||
searchResultsObj =
|
||||
@@ -96,6 +98,12 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
||||
|
||||
//console.log("sssss", searchResultsObj);
|
||||
|
||||
loggedInUser = loggedInUser.value[0].contactid;
|
||||
|
||||
const watchedCases = await getWatchedCases(loggedInUser);
|
||||
|
||||
//console.log("sssss", loggedInUser);
|
||||
|
||||
const [accountDetails, searchDetailsObj, watchedCasesDetails] =
|
||||
await Promise.all([
|
||||
await getPersonalAccount(loggedInUser),
|
||||
@@ -109,6 +117,9 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
||||
store.dispatch(setWatchedCases(watchedCases));
|
||||
store.dispatch(setWatchedCasesDetails(watchedCasesDetails));
|
||||
store.dispatch(setLoggedInUserId(loggedInUser));
|
||||
|
||||
thisSession != false &&
|
||||
store.dispatch(setContainerID(thisSession.user.id));
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ import {
|
||||
setSearchDetails,
|
||||
setSearchResults,
|
||||
} from "../store/searchOutput/action";
|
||||
import { setShowReps } from "../store/currentView/action";
|
||||
import { wrapper } from "../store/store";
|
||||
import _ from "lodash";
|
||||
|
||||
@@ -116,9 +117,9 @@ const Home = (props) => {
|
||||
};
|
||||
|
||||
export const getServerSideProps = wrapper.getServerSideProps(
|
||||
(store) =>
|
||||
async ({ query, req, res }) => {
|
||||
console.log("query-", query);
|
||||
(store) => async (ctx) => {
|
||||
const { query, req, res } = ctx;
|
||||
console.log("query-", query);
|
||||
|
||||
let isLinked =
|
||||
typeof query.lk != "undefined" && query.lk == "1"
|
||||
@@ -127,6 +128,8 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
||||
|
||||
//console.log("is linked:", isLinked);
|
||||
const showLoginCheck = process.env.SHOWLOGIN || false;
|
||||
const showReps = process.env.SHOWREPRESENTATIONS || false;
|
||||
store.dispatch(setShowReps(showReps));
|
||||
|
||||
let searchResultsObj = await getBasicSearch(query.q);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user