Files
stripstream-librarian/apps/backoffice/app/api/jobs/[id]/cancel/route.ts
Froidefond Julien 85cad1a7e7 refactor: streamline API calls and enhance configuration management
- Refactor multiple API routes to utilize a centralized configuration function for base URL and token management, improving code consistency and maintainability.
- Replace direct environment variable access with a unified config function in the `lib/api.ts` file.
- Remove redundant error handling and streamline response handling in various API endpoints.
- Delete unused job-related API routes and settings, simplifying the overall API structure.
2026-03-09 14:16:01 +01:00

16 lines
425 B
TypeScript

import { NextRequest, NextResponse } from "next/server";
import { cancelJob } from "@/lib/api";
export async function POST(
_request: NextRequest,
{ params }: { params: Promise<{ id: string }> }
) {
const { id } = await params;
try {
const data = await cancelJob(id);
return NextResponse.json(data);
} catch (error) {
return NextResponse.json({ error: "Failed to cancel job" }, { status: 500 });
}
}