Implemented server-side authentication redirects: - Root (/) redirects to /chat if authenticated, /login if not - /chat route requires authentication via layout component - Removed deprecated middleware file in favor of Next.js server components This ensures users are properly directed based on their authentication state. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
17 lines
379 B
TypeScript
17 lines
379 B
TypeScript
import { redirect } from 'next/navigation';
|
|
import { cookies } from 'next/headers';
|
|
|
|
/**
|
|
* Root page - redirects to /chat if authenticated, /login if not
|
|
*/
|
|
export default async function Home() {
|
|
const cookieStore = await cookies();
|
|
const authCookie = cookieStore.get('ponderants-auth');
|
|
|
|
if (authCookie) {
|
|
redirect('/chat');
|
|
} else {
|
|
redirect('/login');
|
|
}
|
|
}
|