File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed
Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change 22
33import { InactivityDialog } from "@src/app/_components/inactivity/InactivityDialog" ;
44import SkipLink from "@src/app/_components/nhs-frontend/SkipLink" ;
5+ import { WARNING_TIME_MS } from "@src/utils/auth/inactivity-timer" ;
56import React , { JSX } from "react" ;
67import "@public/nhsuk-frontend-9.1.0/css/nhsuk-9.1.0.min.css" ;
78import "@public/nhsapp-frontend-2.3.0/nhsapp-2.3.0.min.css" ;
@@ -14,6 +15,13 @@ export default function RootLayout({
1415} : Readonly < {
1516 children : React . ReactNode ;
1617} > ) : JSX . Element {
18+ // This is the polling time for the session on client side,
19+ // so that the client can react to session expiry.
20+ // The session expiry is handled by the server.
21+ // The value is set to 10 seconds less than the warning time.
22+ // This is to ensure that the warning dialog is only shown when user is authenticated.
23+ const SESSION_REFETCH_SECONDS = Math . floor ( WARNING_TIME_MS / 1000 ) - 10 ;
24+
1725 return (
1826 < html lang = "en" >
1927 < head >
@@ -74,7 +82,7 @@ export default function RootLayout({
7482
7583 < body >
7684 < SkipLink />
77- < SessionProvider >
85+ < SessionProvider refetchInterval = { SESSION_REFETCH_SECONDS } >
7886 < InactivityDialog />
7987 < div className = "nhsuk-width-container " > { children } </ div >
8088 </ SessionProvider >
You can’t perform that action at this time.
0 commit comments