Published in Botify
Jan 10, 2025
2
export const DELETE = async (req: NextRequest) => {
const products = await client.fetch(`*[_type == "type"]`);
const allIds = products.map((product) => product._id);
for (const id of allIds) {
await client.delete(id);
}
return NextResponse.json({ products: allIds });
};