Add shared device inactivity timeout to AuthGate
This commit is contained in:
parent
9a7d7dd5b4
commit
b280d391e8
1 changed files with 8 additions and 1 deletions
|
|
@ -1,7 +1,14 @@
|
||||||
import { useEffect, useState } from 'react'
|
import { useEffect, useRef, useState } from 'react'
|
||||||
import { useNavigate, useLocation } from 'react-router-dom'
|
import { useNavigate, useLocation } from 'react-router-dom'
|
||||||
import type { User } from '../types'
|
import type { User } from '../types'
|
||||||
|
|
||||||
|
const SHARED_TIMEOUT_MS = 10 * 60 * 1000
|
||||||
|
|
||||||
|
function isSharedDevice() {
|
||||||
|
return document.cookie.split(';').some(c => c.trim() === 'hnf_shared_device=1')
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
interface Props { children: (user: User) => React.ReactNode }
|
interface Props { children: (user: User) => React.ReactNode }
|
||||||
|
|
||||||
export function AuthGate({ children }: Props) {
|
export function AuthGate({ children }: Props) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue