Normalize active session ids in frontend
This commit is contained in:
@@ -10,7 +10,7 @@ export async function GET(req: Request) {
|
||||
const incoming = new URL(req.url);
|
||||
const url = new URL(`${CLAW_API_URL}/api/context-budget`);
|
||||
url.searchParams.set("account_id", account.id);
|
||||
const sessionId = incoming.searchParams.get("session_id");
|
||||
const sessionId = incoming.searchParams.get("session_id")?.trim();
|
||||
if (sessionId) url.searchParams.set("session_id", sessionId);
|
||||
|
||||
try {
|
||||
|
||||
@@ -10,7 +10,8 @@ export async function GET(
|
||||
if (!account)
|
||||
return Response.json({ error: "请先登录账号" }, { status: 401 });
|
||||
|
||||
const { sessionId } = await params;
|
||||
const { sessionId: rawSessionId } = await params;
|
||||
const sessionId = rawSessionId.trim();
|
||||
const url = new URL(`${CLAW_API_URL}/api/sessions/${sessionId}`);
|
||||
url.searchParams.set("account_id", account.id);
|
||||
const response = await fetch(url, { cache: "no-store" });
|
||||
@@ -32,7 +33,8 @@ export async function DELETE(
|
||||
if (!account)
|
||||
return Response.json({ error: "请先登录账号" }, { status: 401 });
|
||||
|
||||
const { sessionId } = await params;
|
||||
const { sessionId: rawSessionId } = await params;
|
||||
const sessionId = rawSessionId.trim();
|
||||
const url = new URL(`${CLAW_API_URL}/api/sessions/${sessionId}`);
|
||||
url.searchParams.set("account_id", account.id);
|
||||
const response = await fetch(url, { method: "DELETE", cache: "no-store" });
|
||||
@@ -54,7 +56,8 @@ export async function PATCH(
|
||||
if (!account)
|
||||
return Response.json({ error: "请先登录账号" }, { status: 401 });
|
||||
|
||||
const { sessionId } = await params;
|
||||
const { sessionId: rawSessionId } = await params;
|
||||
const sessionId = rawSessionId.trim();
|
||||
const url = new URL(`${CLAW_API_URL}/api/sessions/${sessionId}`);
|
||||
url.searchParams.set("account_id", account.id);
|
||||
const response = await fetch(url, {
|
||||
|
||||
Reference in New Issue
Block a user