From fba8529417201e382b23937ac6376afdffe80971 Mon Sep 17 00:00:00 2001 From: rdbsolutions Date: Wed, 20 Apr 2022 16:09:31 +0100 Subject: [PATCH] timeout redirect updated --- components/case/representation/index.js | 24 +++++++++++++++++++----- components/case/summary.js | 2 +- components/homepage/login.js | 4 ++-- components/timeout/index.js | 3 ++- 4 files changed, 24 insertions(+), 9 deletions(-) diff --git a/components/case/representation/index.js b/components/case/representation/index.js index 9f883b2d..f419ed8f 100644 --- a/components/case/representation/index.js +++ b/components/case/representation/index.js @@ -27,6 +27,7 @@ import RepAgent from "./representationAgent"; import RepInterestedPartyPerson from "./representationInterestedPartyPerson"; import RepLandOwner from "./representationLandowner"; import RepCompleteSubmit from "./representationCompleteSubmit"; +import { useSession, signIn, signOut } from "next-auth/react"; import { RenderPickList, @@ -39,6 +40,7 @@ let MakeRepresentation = (props) => { const { acceptedFiles, getRootProps, getInputProps } = useDropzone(); const [clearRepForm, setClearRepForm] = useState(false); + const { data: session } = useSession(); const router = useRouter(); const { locale } = router; @@ -250,11 +252,23 @@ let MakeRepresentation = (props) => { /> ) : ( <> -

- Make a representation on:{" "} - {currentView.caseReference.currentReference} -

- {whichControl()} + {!session ? ( + + ) : ( + <> +

+ Make a representation on:{" "} + {currentView.caseReference.currentReference} +

+ {whichControl()} + + )} )} diff --git a/components/case/summary.js b/components/case/summary.js index 5747900d..1c79e465 100644 --- a/components/case/summary.js +++ b/components/case/summary.js @@ -64,7 +64,7 @@ const CaseSummary = (props) => { } = props; const noRepresentationLink = [ - "/case", + //"/case", "/dnsdetails", "/dns/[developmentName]", ]; diff --git a/components/homepage/login.js b/components/homepage/login.js index a50527ac..72ffeac0 100644 --- a/components/homepage/login.js +++ b/components/homepage/login.js @@ -249,7 +249,7 @@ let Login = (props) => { )} - {/*
+ {validLoginID == false && (
Incorrect username or password @@ -297,7 +297,7 @@ let Login = (props) => {
-
+ {/*

{ diff --git a/components/timeout/index.js b/components/timeout/index.js index 093badd4..927ae660 100644 --- a/components/timeout/index.js +++ b/components/timeout/index.js @@ -4,6 +4,7 @@ import { destroyCookie } from "nookies"; import { useState } from "react"; import IdleTimer from "react-idle-timer"; import TimeoutModal from "./timeoutmodal"; +import { useSession, signIn, signOut } from "next-auth/react"; const TimeOut = (props) => { let { t } = useTranslation(); @@ -41,7 +42,7 @@ const TimeOut = (props) => { console.log("////////////", "\n", "logout", "\n", "//////////"); destroyCookie({}, "pinsUser"), window.localStorage.clear(), - router.replace(props.ggLogout); + signOut({ callbackUrl: "/logout" }); }; return (