From 98b1daa7d3f1bb233d515c72e26a16af594d1581 Mon Sep 17 00:00:00 2001 From: Jack Mechem Date: Fri, 27 Mar 2026 18:44:06 -0700 Subject: [PATCH] Fix type errors --- app/api/services/[service]/[action]/route.ts | 8 +++++--- app/api/services/[service]/logs/route.ts | 15 ++++++--------- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/app/api/services/[service]/[action]/route.ts b/app/api/services/[service]/[action]/route.ts index b81ebf0..515639f 100644 --- a/app/api/services/[service]/[action]/route.ts +++ b/app/api/services/[service]/[action]/route.ts @@ -4,19 +4,21 @@ const ALLOWED_ACTIONS = ["start", "stop", "restart"]; export async function POST( req: NextRequest, - { params }: { params: { service: string; action: string } }, + { params }: { params: Promise<{ service: string; action: string }> }, ) { const token = req.cookies.get("token")?.value; if (!token) { return NextResponse.json({ error: "Unauthorized" }, { status: 401 }); } - if (!ALLOWED_ACTIONS.includes(params.action)) { + const { service, action } = await params; + + if (!ALLOWED_ACTIONS.includes(action)) { return NextResponse.json({ error: "Invalid action" }, { status: 400 }); } const res = await fetch( - `http://localhost:3001/services/${params.service}/${params.action}`, + `http://localhost:3001/services/${service}/${action}`, { method: "POST", headers: { diff --git a/app/api/services/[service]/logs/route.ts b/app/api/services/[service]/logs/route.ts index 3d62668..21ae3a8 100644 --- a/app/api/services/[service]/logs/route.ts +++ b/app/api/services/[service]/logs/route.ts @@ -2,21 +2,18 @@ import { NextRequest, NextResponse } from "next/server"; export async function GET( req: NextRequest, - { params }: { params: { service: string } }, + { params }: { params: Promise<{ service: string }> }, ) { const token = req.cookies.get("token")?.value; if (!token) { return NextResponse.json({ error: "Unauthorized" }, { status: 401 }); } - const res = await fetch( - `http://localhost:3001/services/${params.service}/logs`, - { - headers: { - Authorization: `Bearer ${token}`, - }, - }, - ); + const { service } = await params; + + const res = await fetch(`http://localhost:3001/services/${service}/logs`, { + headers: { Authorization: `Bearer ${token}` }, + }); return NextResponse.json(await res.json(), { status: res.status }); }