refactor: cleanup part 4

This commit is contained in:
trafficlunar 2025-04-14 18:11:17 +01:00
parent f00c998c30
commit 9e36944219
4 changed files with 14 additions and 14 deletions

View file

@ -5,11 +5,11 @@ import { prisma } from "@/lib/prisma";
export async function DELETE() {
const session = await auth();
if (!session) return NextResponse.json({ error: "Unauthorized" }, { status: 401 });
if (!session || !session.user) return NextResponse.json({ error: "Unauthorized" }, { status: 401 });
try {
await prisma.user.delete({
where: { id: Number(session.user?.id!) },
where: { id: Number(session.user.id) },
});
} catch (error) {
console.error("Failed to delete user:", error);