initial webapp
This commit is contained in:
15
app/page.tsx
15
app/page.tsx
@@ -1,5 +1,14 @@
|
||||
import { redirect } from "next/navigation";
|
||||
import { cookies } from 'next/headers';
|
||||
import { redirect } from 'next/navigation';
|
||||
|
||||
export default function Home() {
|
||||
redirect("/welcome");
|
||||
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');
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user