mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-07-04 22:02:16 +02:00
fix(web):centralize session auth fetch
This commit is contained in:
parent
951cb1a717
commit
d2a8d088c7
6 changed files with 142 additions and 266 deletions
|
|
@ -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",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue