MingruiZhang's picture
feat: Minor updates and introducing shadcn (#54)
78ebb49 unverified
raw
history blame
549 Bytes
import { Chat } from '@/components/chat';
import { auth } from '@/auth';
import { dbGetChat } from '@/lib/db/functions';
import { redirect } from 'next/navigation';
import { revalidatePath } from 'next/cache';
interface PageProps {
params: {
id: string;
};
}
export default async function Page({ params }: PageProps) {
const { id: chatId } = params;
const chat = await dbGetChat(chatId);
if (!chat) {
revalidatePath('/');
redirect('/');
}
const session = await auth();
return <Chat chat={chat} session={session} />;
}