update
This commit is contained in:
@@ -10,7 +10,7 @@ export async function GET(
|
|||||||
request: NextRequest,
|
request: NextRequest,
|
||||||
context: { params: Promise<{ id: string }> }
|
context: { params: Promise<{ id: string }> }
|
||||||
) {
|
) {
|
||||||
const { id: pasteId } = await context.params; // ✅ await obligatoire
|
const { id: pasteId } = await context.params;
|
||||||
|
|
||||||
if (!pasteId) {
|
if (!pasteId) {
|
||||||
return NextResponse.json({ error: 'Invalid ID' }, { status: 400 });
|
return NextResponse.json({ error: 'Invalid ID' }, { status: 400 });
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import { authOptions } from '@/lib/auth';
|
import { authOptions } from '@/lib/auth';
|
||||||
import { prisma } from '@/lib/prisma';
|
import { prisma } from '@/lib/prisma';
|
||||||
|
import { Prisma } from '@prisma/client';
|
||||||
import { getServerSession } from 'next-auth';
|
import { getServerSession } from 'next-auth';
|
||||||
import { NextResponse } from 'next/server';
|
import { NextResponse } from 'next/server';
|
||||||
|
|
||||||
@@ -23,7 +24,7 @@ export async function GET(req: Request) {
|
|||||||
? {
|
? {
|
||||||
title: {
|
title: {
|
||||||
contains: search,
|
contains: search,
|
||||||
mode: 'insensitive',
|
mode: Prisma.QueryMode.insensitive,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
: {}),
|
: {}),
|
||||||
@@ -42,4 +43,4 @@ export async function GET(req: Request) {
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
return NextResponse.json({ pastes, total });
|
return NextResponse.json({ pastes, total });
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user