Add 'apps/web/' from commit '1e7174fa604b11e7c3983cd8ad01c596f6e77e96'

git-subtree-dir: apps/web
git-subtree-mainline: 068a51b46b
git-subtree-split: 1e7174fa60
This commit is contained in:
2026-08-16 21:42:59 -04:00
350 changed files with 62192 additions and 0 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 };
}