File tree Expand file tree Collapse file tree
web/src/app/admin/leela/[id] Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11
22import prisma from '@/lib/db' ;
33import LeelaForm from '@/components/admin/LeelaForm' ;
4- import { notFound } from 'next/navigation' ;
4+ import { notFound , redirect } from 'next/navigation' ;
55
66export 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 >
You can’t perform that action at this time.
0 commit comments