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

@@ -0,0 +1,16 @@
import {useSessionStore} from "@/lib/store/sessionStore";
import {useRouter} from "@tanstack/react-router";
export const useLogout = () => {
const {clearSession} = useSessionStore();
const router = useRouter();
const logout = async () => {
router.invalidate();
router.clearCache();
clearSession();
window.location.reload();
};
return logout;
};