This commit is contained in:
@@ -4,9 +4,12 @@ import prisma from '../../../../lib/prisma'
|
||||
type Params = { params: Promise<{ id: string }> }
|
||||
|
||||
// GET /api/offers/[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 offer = await prisma.offer.findUnique({
|
||||
where: { id },
|
||||
include: { business: true },
|
||||
@@ -20,9 +23,12 @@ export async function GET(_request: NextRequest, { params }: Params) {
|
||||
}
|
||||
|
||||
// PATCH /api/offers/[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 offer = await prisma.offer.update({
|
||||
where: { id },
|
||||
@@ -37,9 +43,12 @@ export async function PATCH(request: NextRequest, { params }: Params) {
|
||||
}
|
||||
|
||||
// DELETE /api/offers/[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.offer.delete({ where: { id } })
|
||||
return NextResponse.json({ success: true })
|
||||
} catch (error) {
|
||||
|
||||
Reference in New Issue
Block a user