Files
trackevery-day/app/page.tsx
2025-07-15 18:58:21 +02:00

15 lines
383 B
TypeScript

import { cookies } from 'next/headers';
import { redirect } from 'next/navigation';
export default async function Home() {
const cookieStore = await cookies();
const token = cookieStore.get('habit-tracker-token');
// If user has a token, redirect to dashboard, otherwise to welcome
if (token?.value) {
redirect('/dashboard');
} else {
redirect('/welcome');
}
}