timeout redirect updated

This commit is contained in:
2022-04-20 16:09:31 +01:00
parent 3b1a49e561
commit fba8529417
4 changed files with 24 additions and 9 deletions
+19 -5
View File
@@ -27,6 +27,7 @@ import RepAgent from "./representationAgent";
import RepInterestedPartyPerson from "./representationInterestedPartyPerson"; import RepInterestedPartyPerson from "./representationInterestedPartyPerson";
import RepLandOwner from "./representationLandowner"; import RepLandOwner from "./representationLandowner";
import RepCompleteSubmit from "./representationCompleteSubmit"; import RepCompleteSubmit from "./representationCompleteSubmit";
import { useSession, signIn, signOut } from "next-auth/react";
import { import {
RenderPickList, RenderPickList,
@@ -39,6 +40,7 @@ let MakeRepresentation = (props) => {
const { acceptedFiles, getRootProps, getInputProps } = useDropzone(); const { acceptedFiles, getRootProps, getInputProps } = useDropzone();
const [clearRepForm, setClearRepForm] = useState(false); const [clearRepForm, setClearRepForm] = useState(false);
const { data: session } = useSession();
const router = useRouter(); const router = useRouter();
const { locale } = router; const { locale } = router;
@@ -250,11 +252,23 @@ let MakeRepresentation = (props) => {
/> />
) : ( ) : (
<> <>
<h1 className="govuk-heading-l"> {!session ? (
Make a representation on:{" "} <button
{currentView.caseReference.currentReference} className="govuk-button withChevron govuk-button-cta"
</h1> type="button"
{whichControl()} onClick={() => signIn("email")}
>
Sign in to raise representation
</button>
) : (
<>
<h1 className="govuk-heading-l">
Make a representation on:{" "}
{currentView.caseReference.currentReference}
</h1>
{whichControl()}
</>
)}
</> </>
)} )}
</form> </form>
+1 -1
View File
@@ -64,7 +64,7 @@ const CaseSummary = (props) => {
} = props; } = props;
const noRepresentationLink = [ const noRepresentationLink = [
"/case", //"/case",
"/dnsdetails", "/dnsdetails",
"/dns/[developmentName]", "/dns/[developmentName]",
]; ];
+2 -2
View File
@@ -249,7 +249,7 @@ let Login = (props) => {
</button> </button>
)} )}
</div> </div>
{/* <form onSubmit={handleSubmit(onHandleSubmit)}> <form onSubmit={handleSubmit(onHandleSubmit)}>
{validLoginID == false && ( {validLoginID == false && (
<div className="govuk-error-message govuk-form-group--error"> <div className="govuk-error-message govuk-form-group--error">
Incorrect username or password Incorrect username or password
@@ -297,7 +297,7 @@ let Login = (props) => {
</button> </button>
</div> </div>
</form> </form>
<div className="govuk-form-group govuk-!-margin-top-4"> {/* <div className="govuk-form-group govuk-!-margin-top-4">
<p className="govuk-body-xs"> <p className="govuk-body-xs">
<a <a
onClick={() => { onClick={() => {
+2 -1
View File
@@ -4,6 +4,7 @@ import { destroyCookie } from "nookies";
import { useState } from "react"; import { useState } from "react";
import IdleTimer from "react-idle-timer"; import IdleTimer from "react-idle-timer";
import TimeoutModal from "./timeoutmodal"; import TimeoutModal from "./timeoutmodal";
import { useSession, signIn, signOut } from "next-auth/react";
const TimeOut = (props) => { const TimeOut = (props) => {
let { t } = useTranslation(); let { t } = useTranslation();
@@ -41,7 +42,7 @@ const TimeOut = (props) => {
console.log("////////////", "\n", "logout", "\n", "//////////"); console.log("////////////", "\n", "logout", "\n", "//////////");
destroyCookie({}, "pinsUser"), destroyCookie({}, "pinsUser"),
window.localStorage.clear(), window.localStorage.clear(),
router.replace(props.ggLogout); signOut({ callbackUrl: "/logout" });
}; };
return ( return (