Add user deletion functionality: Implement DELETE API endpoint for user management, allowing admins to remove users while preventing self-deletion. Enhance UserManagement component with delete confirmation and error handling for improved user experience.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { NextResponse } from "next/server";
|
||||
import { auth } from "@/lib/auth";
|
||||
import { prisma } from "@/lib/prisma";
|
||||
import { calculateEventStatus } from "@/lib/eventStatus";
|
||||
|
||||
export async function POST(
|
||||
request: Request,
|
||||
@@ -30,7 +31,8 @@ export async function POST(
|
||||
);
|
||||
}
|
||||
|
||||
if (event.status !== "UPCOMING") {
|
||||
const eventStatus = calculateEventStatus(event.date);
|
||||
if (eventStatus !== "UPCOMING") {
|
||||
return NextResponse.json(
|
||||
{ error: "Vous ne pouvez vous inscrire qu'aux événements à venir" },
|
||||
{ status: 400 }
|
||||
|
||||
Reference in New Issue
Block a user