Merged PR 387: Api content for portal page modules
Related work items: #5270
This commit is contained in:
+15
-2
@@ -65,6 +65,9 @@ const Header = (props) => {
|
|||||||
<div className="govuk-header__content govuk-!-width-one-half govuk-!-margin-top-3">
|
<div className="govuk-header__content govuk-!-width-one-half govuk-!-margin-top-3">
|
||||||
<Link href="/logout">
|
<Link href="/logout">
|
||||||
<a
|
<a
|
||||||
|
onClick={() => {
|
||||||
|
window.localStorage.clear();
|
||||||
|
}}
|
||||||
className="govuk-header__link
|
className="govuk-header__link
|
||||||
govuk-header__link--service-name"
|
govuk-header__link--service-name"
|
||||||
>
|
>
|
||||||
@@ -102,7 +105,12 @@ const Header = (props) => {
|
|||||||
) : (
|
) : (
|
||||||
<li>
|
<li>
|
||||||
<Link href="/logout">
|
<Link href="/logout">
|
||||||
<a className="govuk-header__link ">
|
<a
|
||||||
|
onClick={() => {
|
||||||
|
window.localStorage.clear();
|
||||||
|
}}
|
||||||
|
className="govuk-header__link "
|
||||||
|
>
|
||||||
{t("common:signout-label")}
|
{t("common:signout-label")}
|
||||||
</a>
|
</a>
|
||||||
</Link>
|
</Link>
|
||||||
@@ -152,7 +160,12 @@ const Header = (props) => {
|
|||||||
{router.pathname != "/" ||
|
{router.pathname != "/" ||
|
||||||
router.pathname != "/logout" ? (
|
router.pathname != "/logout" ? (
|
||||||
<Link href="/logout">
|
<Link href="/logout">
|
||||||
<a className="govuk-header__link govuk-!-margin-right-3">
|
<a
|
||||||
|
onClick={() => {
|
||||||
|
window.localStorage.clear();
|
||||||
|
}}
|
||||||
|
className="govuk-header__link govuk-!-margin-right-3"
|
||||||
|
>
|
||||||
{t("common:signout-label")}
|
{t("common:signout-label")}
|
||||||
</a>
|
</a>
|
||||||
</Link>
|
</Link>
|
||||||
|
|||||||
+1
-1
@@ -5,7 +5,7 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "next dev",
|
"dev": "next dev",
|
||||||
"dev:app": "node ./server/server.js && yarn lint:js",
|
"dev:app": "node ./server/server.js && yarn lint:js",
|
||||||
"build": "NODE_ENV=production node_modules/next/dist/bin/next build --debug",
|
"build": "NODE_ENV=production node_modules/next/dist/bin/next build",
|
||||||
"start": "node_modules/next/dist/bin/next start"
|
"start": "node_modules/next/dist/bin/next start"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|||||||
+11
-4
@@ -70,10 +70,17 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
|||||||
async ({ query, req, res }) => {
|
async ({ query, req, res }) => {
|
||||||
//console.log("the query", query);
|
//console.log("the query", query);
|
||||||
|
|
||||||
const myCases = await getMyCases();
|
const [
|
||||||
const myRepresentations = await getMyRepresentations();
|
myCases,
|
||||||
const watchedCases = await getWatchedCases();
|
myRepresentations,
|
||||||
const awaitingSubmission = await getAwaitingSubmission();
|
watchedCases,
|
||||||
|
awaitingSubmission,
|
||||||
|
] = await Promise.all([
|
||||||
|
await getMyCases(),
|
||||||
|
await getMyRepresentations(),
|
||||||
|
await getWatchedCases(),
|
||||||
|
await getAwaitingSubmission(),
|
||||||
|
]);
|
||||||
|
|
||||||
store.dispatch(setMyCases(myCases));
|
store.dispatch(setMyCases(myCases));
|
||||||
store.dispatch(setMyRepresentations(myRepresentations));
|
store.dispatch(setMyRepresentations(myRepresentations));
|
||||||
|
|||||||
@@ -154,15 +154,17 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
|||||||
(store) =>
|
(store) =>
|
||||||
async ({ query, req, res }) => {
|
async ({ query, req, res }) => {
|
||||||
//console.log("the query", query);
|
//console.log("the query", query);
|
||||||
store.dispatch(setAppealTypeID(query.appealtypes));
|
const [appealTypeData, formdata] = await Promise.all([
|
||||||
const appealTypeData = await getAppealsTypes();
|
await getAppealsTypes(),
|
||||||
const formdata = (await getFormData(query.appealtypes)) || null;
|
await getFormData(query.appealtypes),
|
||||||
|
]);
|
||||||
|
|
||||||
const caseReference = createCase("asasa", "asasa");
|
const caseReference = createCase("asasa", "asasa");
|
||||||
|
|
||||||
let xmlStr = formdata;
|
let xmlStr = formdata;
|
||||||
xmlStr = formdata.value[0].formxml;
|
xmlStr = formdata.value[0].formxml;
|
||||||
xmlStr = xmlStr.replace(/\\"/g, "");
|
xmlStr = xmlStr.replace(/\\"/g, "");
|
||||||
|
store.dispatch(setAppealTypeID(query.appealtypes));
|
||||||
store.dispatch(setCaseReference(caseReference));
|
store.dispatch(setCaseReference(caseReference));
|
||||||
store.dispatch(setForm(xmlStr));
|
store.dispatch(setForm(xmlStr));
|
||||||
store.dispatch(setAppealType(appealTypeData));
|
store.dispatch(setAppealType(appealTypeData));
|
||||||
|
|||||||
@@ -75,10 +75,10 @@ const Home = (props) => {
|
|||||||
export const getServerSideProps = wrapper.getServerSideProps(
|
export const getServerSideProps = wrapper.getServerSideProps(
|
||||||
(store) =>
|
(store) =>
|
||||||
async ({ query, req, res }) => {
|
async ({ query, req, res }) => {
|
||||||
const appealTypeData = await getAppealsTypes();
|
const [appealTypeData, lpaData] = await Promise.all([
|
||||||
const lpaData = await getLPA();
|
await getAppealsTypes(),
|
||||||
console.log("appeal types", appealTypeData);
|
await getLPA(),
|
||||||
console.log("lpa typeswwwww", lpaData);
|
]);
|
||||||
store.dispatch(setAppealType(appealTypeData));
|
store.dispatch(setAppealType(appealTypeData));
|
||||||
store.dispatch(setLPA(lpaData));
|
store.dispatch(setLPA(lpaData));
|
||||||
}
|
}
|
||||||
|
|||||||
+6
-1
@@ -95,7 +95,11 @@ const makeStore = ({ isServer }) => {
|
|||||||
return createStore(reducer, bindMiddleware([thunkMiddleware]));
|
return createStore(reducer, bindMiddleware([thunkMiddleware]));
|
||||||
} else {
|
} else {
|
||||||
//If it's on client side, create a store which will persist
|
//If it's on client side, create a store which will persist
|
||||||
const { persistStore, persistReducer } = require("redux-persist");
|
const {
|
||||||
|
persistStore,
|
||||||
|
persistReducer,
|
||||||
|
createMigrate,
|
||||||
|
} = require("redux-persist");
|
||||||
const storage = require("redux-persist/lib/storage").default;
|
const storage = require("redux-persist/lib/storage").default;
|
||||||
|
|
||||||
const persistConfig = {
|
const persistConfig = {
|
||||||
@@ -114,6 +118,7 @@ const makeStore = ({ isServer }) => {
|
|||||||
"watchedCases",
|
"watchedCases",
|
||||||
"form",
|
"form",
|
||||||
],
|
],
|
||||||
|
version: 1,
|
||||||
storage: storage,
|
storage: storage,
|
||||||
stateReconciler: autoMergeLevel2, // if needed, use a safer storage
|
stateReconciler: autoMergeLevel2, // if needed, use a safer storage
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user