Skip to content

Commit fe295a1

Browse files
committed
feat: redirect /leela/new to AI Generator page
1 parent 2b1df21 commit fe295a1

1 file changed

Lines changed: 10 additions & 8 deletions

File tree

web/src/app/admin/leela/[id]/page.tsx

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,25 @@
11

22
import prisma from '@/lib/db';
33
import LeelaForm from '@/components/admin/LeelaForm';
4-
import { notFound } from 'next/navigation';
4+
import { notFound, redirect } from 'next/navigation';
55

66
export default async function AdminLeelaEditPage({ params }: { params: Promise<{ id: string }> }) {
77
const { id } = await params;
88

9-
let leela = null;
10-
if (id !== 'new') {
11-
leela = await prisma.leela.findUnique({
12-
where: { id }
13-
});
14-
if (!leela) notFound();
9+
// Redirect 'new' to AI Generator page
10+
if (id === 'new') {
11+
redirect('/admin/leela/generate');
1512
}
1613

14+
const leela = await prisma.leela.findUnique({
15+
where: { id }
16+
});
17+
if (!leela) notFound();
18+
1719
return (
1820
<div className="max-w-6xl mx-auto p-6">
1921
<h1 className="text-3xl font-bold text-gray-800 mb-8">
20-
{id === 'new' ? 'Add New Leela' : 'Edit Leela'}
22+
Edit Leela
2123
</h1>
2224
<LeelaForm leela={leela} />
2325
</div>

0 commit comments

Comments
 (0)