From 66623fb2a57f5a1b78a4fb4e1efe6d48274b3ed4 Mon Sep 17 00:00:00 2001 From: Nate Kelley Date: Tue, 12 Aug 2025 17:05:02 -0600 Subject: [PATCH] route guard the index --- apps/web-tss/src/routes/index.tsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/apps/web-tss/src/routes/index.tsx b/apps/web-tss/src/routes/index.tsx index 1b0b6f591..fdc656eb6 100644 --- a/apps/web-tss/src/routes/index.tsx +++ b/apps/web-tss/src/routes/index.tsx @@ -1,11 +1,14 @@ -import { createFileRoute } from '@tanstack/react-router'; +import { createFileRoute, redirect } from '@tanstack/react-router'; import logo from '../logo.svg'; export const Route = createFileRoute('/')({ component: App, beforeLoad: async ({ context }) => { const hasUser = context.user; - console.log('hasUser', hasUser); + const isAnonymous = context.user?.is_anonymous; + if (!hasUser || isAnonymous) { + throw redirect({ to: '/auth/login' }); + } }, });