feat(auth): added in a rolling token

This commit is contained in:
2025-03-05 12:10:09 -06:00
parent 5fcadb9fc8
commit 50cf87380d
5 changed files with 73 additions and 10 deletions

View File

@@ -1,5 +1,5 @@
import {useSessionStore} from "@/lib/store/sessionStore";
import {useRouter} from "@tanstack/react-router";
import {useSessionStore} from "../store/sessionStore";
export const useLogout = () => {
const {clearSession} = useSessionStore();

View File

@@ -1,5 +1,5 @@
import {useQuery} from "@tanstack/react-query";
import {useSessionStore} from "../store/sessionStore";
import {useSessionStore} from "../lib/store/sessionStore";
import {useEffect} from "react";
const fetchSession = async () => {
@@ -34,6 +34,7 @@ export const useSession = () => {
staleTime: 60 * 1000,
gcTime: 10 * 60 * 1000, // 10 mins
refetchOnWindowFocus: true,
//refetchInterval: 1000 * 60 * 2, // Auto-refetch every 2 minutes
});
useEffect(() => {
if (data) {