This commit is contained in:
Igor Loskutov
2025-09-02 14:44:10 -04:00
parent 5ffc312d4a
commit 31c44ac0bb
11 changed files with 52 additions and 78 deletions

View File

@@ -9,15 +9,16 @@
import { useSession } from "next-auth/react";
import { useEffect } from "react";
import { CustomSession } from "./types";
import { assertExtendedToken, CustomSession } from "./types";
export function SessionAutoRefresh({
children,
refreshInterval = 20 /* seconds */,
}) {
const { data: session, update } = useSession();
const customSession = session as CustomSession;
const accessTokenExpires = customSession?.accessTokenExpires;
const accessTokenExpires = session
? assertExtendedToken(session).accessTokenExpires
: null;
useEffect(() => {
const interval = setInterval(() => {