15 lines
538 B
TypeScript
15 lines
538 B
TypeScript
import { listRecentJobs } from "../../../lib/queue";
|
|
|
|
export async function loader({ request }: { request: Request }) {
|
|
const url = new URL(request.url);
|
|
const ticker = url.searchParams.get("ticker") || undefined;
|
|
const limit = parseInt(url.searchParams.get("limit") || "50", 10);
|
|
try {
|
|
const jobs = await listRecentJobs(ticker || undefined, limit);
|
|
return Response.json({ jobs });
|
|
} catch (err) {
|
|
console.error("/api/jobs index error:", err);
|
|
return Response.json({ error: "internal" }, { status: 500 });
|
|
}
|
|
}
|