Files
WikiRush/app/api/account/route.ts
T

15 lines
411 B
TypeScript
Raw Normal View History

import { NextResponse } from "next/server";
import { auth } from "../../../auth";
import { prisma } from "../../../lib/prisma";
export async function DELETE() {
const session = await auth();
if (!session?.user?.id) {
return NextResponse.json({ error: "Non connecté" }, { status: 401 });
}
await prisma.user.delete({ where: { id: session.user.id } });
return NextResponse.json({ ok: true });
}