Skip to content

Commit

Permalink
add colons
Browse files Browse the repository at this point in the history
  • Loading branch information
ocitocit committed Oct 16, 2023
1 parent 00154fc commit c1133cd
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions app/api/listings/[listingId]/route.ts
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
import getCurrentUser from '@/actions/getCurrentUser'
import prisma from '@/libs/prismadb'
import { NextResponse } from 'next/server'
import getCurrentUser from '@/actions/getCurrentUser';
import prisma from '@/libs/prismadb';
import { NextResponse } from 'next/server';

interface IParams {
listingId?:string
listingId?: string;
}

export async function DELETE(
request:Request,
{params}:{params:IParams}
){
const currentUser = await getCurrentUser()
request: Request,
{ params }: { params: IParams }
) {
const currentUser = await getCurrentUser();

if (!currentUser){
return NextResponse.error()
if (!currentUser) {
return NextResponse.error();
}

const {listingId}=params
const { listingId } = params;

if(!listingId||typeof listingId !== 'string'){
throw new Error('Invalid ID')
if (!listingId || typeof listingId !== 'string') {
throw new Error('Invalid ID');
}

const listing = await prisma.listing.deleteMany({
where:{
id:listingId,
userId:currentUser.id
where: {
id: listingId,
userId: currentUser.id
}
})

return NextResponse.json(listing)
}
return NextResponse.json(listing);
};

0 comments on commit c1133cd

Please sign in to comment.