fix: missing publicTokenExpiresAt

This commit is contained in:
2026-06-11 12:19:13 -04:00
parent 48d3335f12
commit 94e0a18bf5
7 changed files with 50 additions and 9 deletions
+34
View File
@@ -0,0 +1,34 @@
"use client";
import { useEffect, useState } from "react";
import { authClient } from "~/lib/auth-client";
type AuthSession = typeof authClient.$Infer.Session;
export function useAuthSession() {
const [session, setSession] = useState<AuthSession | null>(null);
const [isPending, setIsPending] = useState(true);
useEffect(() => {
let isCurrent = true;
async function loadSession() {
const { data } = await authClient.getSession().catch(() => ({
data: null,
}));
if (isCurrent) {
setSession(data);
setIsPending(false);
}
}
void loadSession();
return () => {
isCurrent = false;
};
}, []);
return { data: session, isPending };
}