fix: update API routes to handle Next.js 15+ params as Promise

This commit is contained in:
2026-03-31 10:44:39 -07:00
parent d595dfa62d
commit 2062188cb3
+6 -6
View File
@@ -4,7 +4,7 @@ import { hasRole } from "@/lib/permissions";
export async function PUT(
request: Request,
{ params }: { params: { id: string } }
{ params }: { params: Promise<{ id: string }> }
) {
// Check permissions
const permission = await hasRole("club_admin");
@@ -16,7 +16,7 @@ export async function PUT(
}
try {
const { id } = params;
const { id } = await params;
const body = await request.json();
const { email, name, role, playerId } = body;
@@ -83,7 +83,7 @@ export async function PUT(
export async function DELETE(
request: Request,
{ params }: { params: { id: string } }
{ params }: { params: Promise<{ id: string }> }
) {
// Check permissions - only site_admin can delete users
const permission = await hasRole("site_admin");
@@ -95,7 +95,7 @@ export async function DELETE(
}
try {
const { id } = params;
const { id } = await params;
// Check if user exists
const existingUser = await prisma.user.findUnique({
@@ -149,7 +149,7 @@ export async function DELETE(
export async function GET(
request: Request,
{ params }: { params: { id: string } }
{ params }: { params: Promise<{ id: string }> }
) {
// Check permissions
const permission = await hasRole("club_admin");
@@ -161,7 +161,7 @@ export async function GET(
}
try {
const { id } = params;
const { id } = await params;
const user = await prisma.user.findUnique({
where: { id },