information banner from api with date range
This commit is contained in:
@@ -51,6 +51,7 @@ export default NextAuth({
|
||||
reference: reference,
|
||||
// emailReplyToId: emailReplyToId,
|
||||
})
|
||||
.then((response) => console.log(response))
|
||||
.catch((err) => consoleLogger(err));
|
||||
},
|
||||
}),
|
||||
|
||||
@@ -4,6 +4,7 @@ import {
|
||||
getToken,
|
||||
azureHeaders,
|
||||
getBasicSearchDetails,
|
||||
consoleLogger,
|
||||
} from "../../../actions";
|
||||
|
||||
const WORDKEY = process.env.HASHKEY;
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
const ApiResponse = (req, res) => {
|
||||
res.statusCode = 200;
|
||||
res.json({
|
||||
"value": [
|
||||
{
|
||||
"notice_en":
|
||||
"An update has been made, if you experience problems,refresh your cache,lorem ipsum doooo orem ipsum doooo orem ipsum doooo orem ipsum doooo dah",
|
||||
"notice_cy":
|
||||
"Mae diweddariad wedi'i wneud, os ydych chi'n cael problemau, adnewyddwch eich storfa, lorem ipsum doooo orem ipsum doooo orem ipsum doooo orem ipsum doooo dah",
|
||||
|
||||
"dateFrom": "20/09/2022",
|
||||
"dateTo": "20/09/2023",
|
||||
},
|
||||
],
|
||||
});
|
||||
};
|
||||
export default ApiResponse;
|
||||
+29
-1
@@ -4,7 +4,7 @@ import Head from "next/head";
|
||||
import { useRouter } from "next/router";
|
||||
import { setCookie } from "nookies";
|
||||
import { connect } from "react-redux";
|
||||
import { getToken, hashString } from "../actions";
|
||||
import { getNotice, getToken, hashString } from "../actions";
|
||||
import {
|
||||
getGGToken,
|
||||
getPortalLogin,
|
||||
@@ -16,6 +16,7 @@ import Footer from "../components/footer";
|
||||
import Header from "../components/header";
|
||||
import Main from "../components/main";
|
||||
import ServiceBanner from "../components/servicebanner";
|
||||
import NoticeBanner from "../components/noticebanner";
|
||||
import {
|
||||
setAccountDetails,
|
||||
setContainerID,
|
||||
@@ -36,6 +37,7 @@ const Home = (props) => {
|
||||
loggedInUserEmail,
|
||||
ggLocale,
|
||||
hasLoginCode,
|
||||
noticeContent,
|
||||
} = props;
|
||||
let { t, lang } = useTranslation();
|
||||
|
||||
@@ -78,6 +80,26 @@ const Home = (props) => {
|
||||
}))
|
||||
: console.log("no value in user id");
|
||||
|
||||
var noticeDateFrom = new Date(
|
||||
noticeContent.value[0].dateFrom.split("/")[2],
|
||||
noticeContent.value[0].dateFrom.split("/")[1] - 1,
|
||||
noticeContent.value[0].dateFrom.split("/")[0]
|
||||
);
|
||||
|
||||
var noticeDateTo = new Date(
|
||||
noticeContent.value[0].dateTo.split("/")[2],
|
||||
noticeContent.value[0].dateTo.split("/")[1] - 1,
|
||||
noticeContent.value[0].dateTo.split("/")[0]
|
||||
);
|
||||
|
||||
var today = new Date();
|
||||
var day = today.getDate();
|
||||
var month = today.getMonth();
|
||||
var year = today.getFullYear();
|
||||
|
||||
today = new Date(year, month, day);
|
||||
const displayNotice = today >= noticeDateFrom && today <= noticeDateTo;
|
||||
|
||||
return (
|
||||
<div>
|
||||
<Head>
|
||||
@@ -147,6 +169,9 @@ const Home = (props) => {
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
{displayNotice && (
|
||||
<NoticeBanner noticeContent={noticeContent} />
|
||||
)}
|
||||
<ServiceBanner />
|
||||
<Main
|
||||
ggLocale={ggLocale}
|
||||
@@ -192,6 +217,8 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
||||
|
||||
// store.dispatch(getGovGatewayConfig(providerConfig));
|
||||
|
||||
const noticeContent = await getNotice();
|
||||
|
||||
let ggToken = {};
|
||||
let ggUserInfo = {};
|
||||
let portalUserObj = {};
|
||||
@@ -241,6 +268,7 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
||||
loggedInUserId: portalUserObj,
|
||||
loggedInUserEmail: loginEmailStr,
|
||||
hasLoginCode: hasLoginCode,
|
||||
noticeContent: noticeContent,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ import useTranslation from "next-translate/useTranslation";
|
||||
import Head from "next/head";
|
||||
import { useRouter } from "next/router";
|
||||
import { connect } from "react-redux";
|
||||
import { getAppealsTypes, getLPA } from "../../actions";
|
||||
import { getAppealsTypes, getLPA, getPersonalAccount } from "../../actions";
|
||||
import { getProviderConfig } from "../../actions/govgateway";
|
||||
import Breadcrumbs from "../../components/breadcrumbs";
|
||||
import CookieBanner from "../../components/cookieBanner";
|
||||
@@ -16,6 +16,12 @@ import { setAppealType } from "../../store/appealType/action";
|
||||
import { getGovGatewayConfig } from "../../store/govgateway/action";
|
||||
import { setLPA } from "../../store/lpa/action";
|
||||
import { wrapper } from "../../store/store";
|
||||
import { getSession, useSession } from "next-auth/react";
|
||||
import {
|
||||
setAccountDetails,
|
||||
setContainerID,
|
||||
setLoggedInUserId,
|
||||
} from "../../store/accountDetails/action";
|
||||
|
||||
const Home = (props) => {
|
||||
const { footerLinks, pages } = props;
|
||||
@@ -61,21 +67,32 @@ const Home = (props) => {
|
||||
};
|
||||
|
||||
export const getServerSideProps = wrapper.getServerSideProps(
|
||||
(store) =>
|
||||
async ({ query, req, res }) => {
|
||||
const [appealTypeData, lpaData] = await Promise.all([
|
||||
await getAppealsTypes(),
|
||||
await getLPA(),
|
||||
]);
|
||||
const providerConfig = await getProviderConfig();
|
||||
store.dispatch(getGovGatewayConfig(providerConfig));
|
||||
(store) => async (ctx) => {
|
||||
const { query, req, res } = ctx;
|
||||
console.log("query-", query);
|
||||
|
||||
// const lpaData = require("../../data/lpa.json");
|
||||
// const appealTypeData = require("../../data/appealtypes.json");
|
||||
const { cookies } = req;
|
||||
|
||||
store.dispatch(setAppealType(appealTypeData));
|
||||
store.dispatch(setLPA(lpaData));
|
||||
}
|
||||
let loggedInUser = cookies.pinsUser;
|
||||
|
||||
let thisSession = await getSession(ctx);
|
||||
|
||||
const [accountDetails, appealTypeData, lpaData] = await Promise.all([
|
||||
await getPersonalAccount(loggedInUser),
|
||||
await getAppealsTypes(),
|
||||
await getLPA(),
|
||||
]);
|
||||
const providerConfig = await getProviderConfig();
|
||||
store.dispatch(getGovGatewayConfig(providerConfig));
|
||||
|
||||
// const lpaData = require("../../data/lpa.json");
|
||||
// const appealTypeData = require("../../data/appealtypes.json");
|
||||
|
||||
store.dispatch(setAccountDetails(accountDetails));
|
||||
store.dispatch(setAppealType(appealTypeData));
|
||||
store.dispatch(setLPA(lpaData));
|
||||
store.dispatch(setLoggedInUserId(loggedInUser));
|
||||
}
|
||||
);
|
||||
|
||||
const mapStateToProps = (state) => {
|
||||
|
||||
@@ -7,6 +7,14 @@ import CookieBanner from "../../components/cookieBanner";
|
||||
import Footer from "../../components/footer";
|
||||
import Header from "../../components/header";
|
||||
import Case from "../../components/representation";
|
||||
import { wrapper } from "../../store/store";
|
||||
import { getSession, useSession } from "next-auth/react";
|
||||
import { getPersonalAccount } from "../../actions";
|
||||
import {
|
||||
setAccountDetails,
|
||||
setContainerID,
|
||||
setLoggedInUserId,
|
||||
} from "../../store/accountDetails/action";
|
||||
|
||||
const Home = (props) => {
|
||||
const { footerLinks, pages } = props;
|
||||
@@ -113,10 +121,35 @@ const Home = (props) => {
|
||||
);
|
||||
};
|
||||
|
||||
// export const getServerSideProps = wrapper.getServerSideProps(
|
||||
// (store) => async (ctx) => {
|
||||
// const { query, req, res } = ctx;
|
||||
// console.log("The query", query);
|
||||
|
||||
// const { cookies } = req;
|
||||
|
||||
// let loggedInUser = cookies.pinsUser;
|
||||
|
||||
// let thisSession = await getSession(ctx);
|
||||
|
||||
// console.log(loggedInUser, thisSession);
|
||||
|
||||
// const accountDetails = await getPersonalAccount(loggedInUser);
|
||||
// store.dispatch(setAccountDetails(accountDetails));
|
||||
|
||||
// return {
|
||||
// props: {
|
||||
// containerID: thisSession.user.id,
|
||||
// },
|
||||
// };
|
||||
// }
|
||||
// );
|
||||
|
||||
const mapStateToProps = (state) => {
|
||||
//console.log(state);
|
||||
|
||||
return {
|
||||
accountDetails: state.accountDetails,
|
||||
currentView: state.currentView,
|
||||
search: state.search,
|
||||
searchResultsObj: state.searchResultsObj,
|
||||
|
||||
@@ -3,6 +3,7 @@ import Head from "next/head";
|
||||
import { useRouter } from "next/router";
|
||||
import { connect } from "react-redux";
|
||||
import {
|
||||
getPersonalAccount,
|
||||
getBasicSearch,
|
||||
getPortalModuleDetails,
|
||||
getWatchedCases,
|
||||
@@ -29,6 +30,12 @@ import {
|
||||
import TimeOut from "../../components/timeout";
|
||||
import { getGovGatewayConfig } from "../../store/govgateway/action";
|
||||
import { getProviderConfig } from "../../actions/govgateway";
|
||||
import { getSession, useSession } from "next-auth/react";
|
||||
import {
|
||||
setAccountDetails,
|
||||
setContainerID,
|
||||
setLoggedInUserId,
|
||||
} from "../../store/accountDetails/action";
|
||||
|
||||
const Home = (props) => {
|
||||
const { footerLinks, pages, watchedCases } = props;
|
||||
@@ -73,6 +80,8 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
||||
|
||||
let loggedInUser = cookies.pinsUser;
|
||||
|
||||
let thisSession = await getSession(ctx);
|
||||
|
||||
let [searchResultsObj, watchedCases] = await Promise.all([
|
||||
await getBasicSearch(query.q),
|
||||
await getWatchedCases(loggedInUser),
|
||||
@@ -89,17 +98,21 @@ export const getServerSideProps = wrapper.getServerSideProps(
|
||||
|
||||
//console.log("sssss", searchResultsObj);
|
||||
|
||||
const [searchDetailsObj, watchedCasesDetails] = await Promise.all([
|
||||
await getSearchDetails(searchResultsObj),
|
||||
await getDetails(watchedCases, "myWatchedCases"),
|
||||
]);
|
||||
const [accountDetails, searchDetailsObj, watchedCasesDetails] =
|
||||
await Promise.all([
|
||||
await getPersonalAccount(loggedInUser),
|
||||
await getSearchDetails(searchResultsObj),
|
||||
await getDetails(watchedCases, "myWatchedCases"),
|
||||
]);
|
||||
const providerConfig = await getProviderConfig();
|
||||
store.dispatch(setAccountDetails(accountDetails));
|
||||
store.dispatch(getGovGatewayConfig(providerConfig));
|
||||
store.dispatch(setSearchResults(searchResultsObj));
|
||||
store.dispatch(setSearchDetails(searchDetailsObj));
|
||||
store.dispatch(setSearch(query.q));
|
||||
store.dispatch(setWatchedCases(watchedCases));
|
||||
store.dispatch(setWatchedCasesDetails(watchedCasesDetails));
|
||||
store.dispatch(setLoggedInUserId(loggedInUser));
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user