fix: update route params to Promise for Next.js 15

This commit is contained in:
Apple
2025-11-28 03:31:51 -08:00
parent 594a05f969
commit 3693611447
5 changed files with 10 additions and 10 deletions

View File

@@ -4,7 +4,7 @@ const API_BASE = process.env.CITY_API_BASE_URL;
export async function DELETE(
req: NextRequest,
{ params }: { params: { agentId: string; microdaoId: string } }
{ params }: { params: Promise<{ agentId: string; microdaoId: string }> }
) {
if (!API_BASE) {
return NextResponse.json(
@@ -13,7 +13,7 @@ export async function DELETE(
);
}
const { agentId, microdaoId } = params;
const { agentId, microdaoId } = await params;
const accessToken = req.cookies.get("daarion_access_token")?.value;
const headers: Record<string, string> = {};

View File

@@ -4,7 +4,7 @@ const API_BASE = process.env.CITY_API_BASE_URL;
export async function PUT(
req: NextRequest,
{ params }: { params: { agentId: string } }
{ params }: { params: Promise<{ agentId: string }> }
) {
if (!API_BASE) {
return NextResponse.json(
@@ -13,7 +13,7 @@ export async function PUT(
);
}
const { agentId } = params;
const { agentId } = await params;
const accessToken = req.cookies.get("daarion_access_token")?.value;
const headers: Record<string, string> = {
"Content-Type": "application/json",

View File

@@ -4,7 +4,7 @@ const API_BASE = process.env.CITY_API_BASE_URL;
export async function POST(
req: NextRequest,
{ params }: { params: { slug: string } }
{ params }: { params: Promise<{ slug: string }> }
) {
if (!API_BASE) {
return NextResponse.json(
@@ -13,7 +13,7 @@ export async function POST(
);
}
const { slug } = params;
const { slug } = await params;
const body = await req.json().catch(() => ({}));
try {

View File

@@ -4,7 +4,7 @@ const API_BASE = process.env.CITY_API_BASE_URL;
export async function GET(
_req: NextRequest,
{ params }: { params: { slug: string } }
{ params }: { params: Promise<{ slug: string }> }
) {
if (!API_BASE) {
return NextResponse.json(
@@ -13,7 +13,7 @@ export async function GET(
);
}
const { slug } = params;
const { slug } = await params;
try {
const res = await fetch(
`${API_BASE}/public/citizens/${encodeURIComponent(slug)}/interaction`,

View File

@@ -4,7 +4,7 @@ const API_BASE = process.env.CITY_API_BASE_URL;
export async function GET(
_req: NextRequest,
{ params }: { params: { slug: string } }
{ params }: { params: Promise<{ slug: string }> }
) {
if (!API_BASE) {
return NextResponse.json(
@@ -13,7 +13,7 @@ export async function GET(
);
}
const { slug } = params;
const { slug } = await params;
try {
const res = await fetch(