fix: update route params to Promise for Next.js 15
This commit is contained in:
@@ -4,7 +4,7 @@ const API_BASE = process.env.CITY_API_BASE_URL;
|
|||||||
|
|
||||||
export async function DELETE(
|
export async function DELETE(
|
||||||
req: NextRequest,
|
req: NextRequest,
|
||||||
{ params }: { params: { agentId: string; microdaoId: string } }
|
{ params }: { params: Promise<{ agentId: string; microdaoId: string }> }
|
||||||
) {
|
) {
|
||||||
if (!API_BASE) {
|
if (!API_BASE) {
|
||||||
return NextResponse.json(
|
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 accessToken = req.cookies.get("daarion_access_token")?.value;
|
||||||
const headers: Record<string, string> = {};
|
const headers: Record<string, string> = {};
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ const API_BASE = process.env.CITY_API_BASE_URL;
|
|||||||
|
|
||||||
export async function PUT(
|
export async function PUT(
|
||||||
req: NextRequest,
|
req: NextRequest,
|
||||||
{ params }: { params: { agentId: string } }
|
{ params }: { params: Promise<{ agentId: string }> }
|
||||||
) {
|
) {
|
||||||
if (!API_BASE) {
|
if (!API_BASE) {
|
||||||
return NextResponse.json(
|
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 accessToken = req.cookies.get("daarion_access_token")?.value;
|
||||||
const headers: Record<string, string> = {
|
const headers: Record<string, string> = {
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ const API_BASE = process.env.CITY_API_BASE_URL;
|
|||||||
|
|
||||||
export async function POST(
|
export async function POST(
|
||||||
req: NextRequest,
|
req: NextRequest,
|
||||||
{ params }: { params: { slug: string } }
|
{ params }: { params: Promise<{ slug: string }> }
|
||||||
) {
|
) {
|
||||||
if (!API_BASE) {
|
if (!API_BASE) {
|
||||||
return NextResponse.json(
|
return NextResponse.json(
|
||||||
@@ -13,7 +13,7 @@ export async function POST(
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const { slug } = params;
|
const { slug } = await params;
|
||||||
const body = await req.json().catch(() => ({}));
|
const body = await req.json().catch(() => ({}));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ const API_BASE = process.env.CITY_API_BASE_URL;
|
|||||||
|
|
||||||
export async function GET(
|
export async function GET(
|
||||||
_req: NextRequest,
|
_req: NextRequest,
|
||||||
{ params }: { params: { slug: string } }
|
{ params }: { params: Promise<{ slug: string }> }
|
||||||
) {
|
) {
|
||||||
if (!API_BASE) {
|
if (!API_BASE) {
|
||||||
return NextResponse.json(
|
return NextResponse.json(
|
||||||
@@ -13,7 +13,7 @@ export async function GET(
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const { slug } = params;
|
const { slug } = await params;
|
||||||
try {
|
try {
|
||||||
const res = await fetch(
|
const res = await fetch(
|
||||||
`${API_BASE}/public/citizens/${encodeURIComponent(slug)}/interaction`,
|
`${API_BASE}/public/citizens/${encodeURIComponent(slug)}/interaction`,
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ const API_BASE = process.env.CITY_API_BASE_URL;
|
|||||||
|
|
||||||
export async function GET(
|
export async function GET(
|
||||||
_req: NextRequest,
|
_req: NextRequest,
|
||||||
{ params }: { params: { slug: string } }
|
{ params }: { params: Promise<{ slug: string }> }
|
||||||
) {
|
) {
|
||||||
if (!API_BASE) {
|
if (!API_BASE) {
|
||||||
return NextResponse.json(
|
return NextResponse.json(
|
||||||
@@ -13,7 +13,7 @@ export async function GET(
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const { slug } = params;
|
const { slug } = await params;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const res = await fetch(
|
const res = await fetch(
|
||||||
|
|||||||
Reference in New Issue
Block a user