feat(auth): use the cookie session and refresh on 401

The token is no longer stored; a tbp_session flag remembers the
login. apiFetch renews the session once on a 401 and sends the
request again. Parallel requests and other tabs share one refresh,
because Auth revokes the session when a refresh token is used twice.
Only a 401 from the refresh ends the session; a 502 or no network
shows the normal error.
This commit is contained in:
lobo committed 2026-09-25 13:45:08 +02:00
1 parent 5ff8d48c53
commit d9a39dda22
34 files changed
+297 -147

No files matched your search

+2 -2
View File
@@ -10,7 +10,7 @@ import {Card} from '@/components/ui/card';
import {Skeleton} from '@/components/ui/skeleton';
import GameCover from '../components/GameCover.jsx';
import StatCard from '../components/StatCard.jsx';
import {getValidToken} from '../utils/auth.js';
import {hasSession} from '../utils/auth.js';
import usePublicStats from '../hooks/usePublicStats.js';
@@ -64,7 +64,7 @@ export default function LandingPage() {
<h1 className="text-4xl font-bold tracking-tight md:text-6xl">{t('MAIN.WELCOME')}</h1>
<p className="mx-auto mt-6 max-w-2xl text-lg text-muted-foreground">{t('MAIN.DESCRIPTION')}</p>
<Button asChild size="lg" className="mt-10">
{getValidToken() ? (
{hasSession() ? (
<Link to="/dashboard">{t('NAV.TO_DASHBOARD')}<ArrowRight/></Link>
) : (
<Link to="/login">{t('MAIN.GET_STARTED')}<ArrowRight/></Link>