fix build
Some checks failed
Build and Push App / build (push) Failing after 21s

This commit is contained in:
2026-04-15 22:40:04 +02:00
parent a38c5d1638
commit 889e70bfc0
16 changed files with 135 additions and 42 deletions

View File

@@ -4,9 +4,12 @@ import prisma from '../../../../lib/prisma'
type Params = { params: Promise<{ id: string }> }
// GET /api/blog/[id]
export async function GET(_request: NextRequest, { params }: Params) {
export async function GET(
_request: NextRequest,
context: { params: Promise<{ id: string }> }
): Promise<Response> {
try {
const { id } = await params
const { id } = await context.params
const post = await prisma.blogPost.findUnique({ where: { id } })
if (!post) return NextResponse.json({ error: 'Non trouvé' }, { status: 404 })
return NextResponse.json(post)
@@ -17,9 +20,12 @@ export async function GET(_request: NextRequest, { params }: Params) {
}
// PATCH /api/blog/[id]
export async function PATCH(request: NextRequest, { params }: Params) {
export async function PATCH(
request: NextRequest,
context: { params: Promise<{ id: string }> }
): Promise<Response> {
try {
const { id } = await params
const { id } = await context.params
const body = await request.json()
const post = await prisma.blogPost.update({ where: { id }, data: body })
return NextResponse.json(post)
@@ -30,9 +36,12 @@ export async function PATCH(request: NextRequest, { params }: Params) {
}
// DELETE /api/blog/[id]
export async function DELETE(_request: NextRequest, { params }: Params) {
export async function DELETE(
_request: NextRequest,
context: { params: Promise<{ id: string }> }
): Promise<Response> {
try {
const { id } = await params
const { id } = await context.params
await prisma.blogPost.delete({ where: { id } })
return NextResponse.json({ success: true })
} catch (error) {