fix(web):centralize session auth fetch

This commit is contained in:
Anish Sarkar 2026-06-24 03:55:40 +05:30
parent 951cb1a717
commit d2a8d088c7
6 changed files with 142 additions and 266 deletions

View file

@ -5,7 +5,7 @@ import { buildBackendUrl } from "@/lib/env-config";
type SessionState =
| { status: "loading"; authenticated: false; accessExpiresAt: null }
| { status: "authenticated"; authenticated: true; accessExpiresAt: number }
| { status: "authenticated"; authenticated: true; accessExpiresAt: number | null }
| { status: "unauthenticated"; authenticated: false; accessExpiresAt: null };
export function useSession() {
@ -30,7 +30,7 @@ export function useSession() {
}
const data = (await response.json()) as {
authenticated: boolean;
access_expires_at: number;
access_expires_at: number | null;
};
setState({
status: "authenticated",