Fix routing: move job loader into index and keep cancel as nested action (avoid duplicate file/folder)\n\nCo-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
import { getJob } from "../../../../lib/queue";
|
||||
|
||||
export async function loader({ params }: { params: { jobId: string } }) {
|
||||
const jobId = params.jobId;
|
||||
if (!jobId) return Response.json({ error: "jobId required" }, { status: 400 });
|
||||
|
||||
try {
|
||||
const job = await getJob(jobId);
|
||||
if (!job) return Response.json({ error: "Job not found" }, { status: 404 });
|
||||
return Response.json(job);
|
||||
} catch (err) {
|
||||
console.error("/api/jobs loader error:", err);
|
||||
return Response.json({ error: "internal" }, { status: 500 });
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user