import { headers } from 'next/headers';
import { redirect } from 'next/navigation';
import { auth } from '@/lib/auth';
export default async function AuthLayout({
children,
}: {
children: React.ReactNode;
}) {
const user = await auth.api.getSession({
headers: await headers(),
});
if (user) {
redirect('/dashboard');
}
return <>{children}</>;
}
import { headers } from 'next/headers';
import { redirect } from 'next/navigation';
import { auth } from '@/lib/auth';
export default async function AuthLayout({
children,
}: {
children: React.ReactNode;
}) {
const user = await auth.api.getSession({
headers: await headers(),
});
if (user) {
redirect('/dashboard');
}
return <>{children}</>;
}