add library management
This commit is contained in:
17
src/app/api/libraries/[id]/route.ts
Normal file
17
src/app/api/libraries/[id]/route.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import { NextRequest, NextResponse } from 'next/server'
|
||||
import { getLibrary, removeLibrary } from '@/lib/libraries'
|
||||
|
||||
export async function DELETE(
|
||||
_request: NextRequest,
|
||||
{ params }: { params: Promise<{ id: string }> }
|
||||
) {
|
||||
const { id } = await params
|
||||
|
||||
const library = getLibrary(id)
|
||||
if (!library) {
|
||||
return NextResponse.json({ error: 'Library not found' }, { status: 404 })
|
||||
}
|
||||
|
||||
removeLibrary(id)
|
||||
return new NextResponse(null, { status: 204 })
|
||||
}
|
||||
Reference in New Issue
Block a user