build bug fix
This commit is contained in:
parent
627522295f
commit
0e34a6433b
1 changed files with 9 additions and 9 deletions
|
|
@ -5,19 +5,19 @@ import { directusFetch } from "@/lib/directus";
|
|||
type MapEntry = { path: string; fields: string; label: (x: any) => string };
|
||||
|
||||
const MAP: Record<string, MapEntry> = {
|
||||
material: { path: "/items/material", fields: "id,name", label: (x) => String(x.name ?? x.id) },
|
||||
material_coating: { path: "/items/material_coating", fields: "id,name", label: (x) => String(x.name ?? x.id) },
|
||||
material_color: { path: "/items/material_color", fields: "id,name", label: (x) => String(x.name ?? x.id) },
|
||||
material_opacity: { path: "/items/material_opacity", fields: "id,opacity", label: (x) => String(x.opacity ?? x.id) },
|
||||
laser_software: { path: "/items/laser_software", fields: "id,name", label: (x) => String(x.name ?? x.id) },
|
||||
// laser_source and lens are handled by dedicated routes
|
||||
material: { path: "/items/material", fields: "id,name", label: (x) => String(x.name ?? x.id) },
|
||||
material_coating: { path: "/items/material_coating", fields: "id,name", label: (x) => String(x.name ?? x.id) },
|
||||
material_color: { path: "/items/material_color", fields: "id,name", label: (x) => String(x.name ?? x.id) },
|
||||
material_opacity: { path: "/items/material_opacity", fields: "id,opacity", label: (x) => String(x.opacity ?? x.id) },
|
||||
laser_software: { path: "/items/laser_software", fields: "id,name", label: (x) => String(x.name ?? x.id) },
|
||||
// laser_source and lens have dedicated routes
|
||||
};
|
||||
|
||||
export async function GET(req: Request, ctx: { params: { collection: string } }) {
|
||||
export async function GET(req: Request, ctx: any) {
|
||||
try {
|
||||
const { searchParams } = new URL(req.url);
|
||||
const key = ctx.params.collection;
|
||||
const q = (searchParams.get("q") || "").trim().toLowerCase();
|
||||
const key = ctx?.params?.collection as string;
|
||||
const q = (searchParams.get("q") || "").trim().toLowerCase();
|
||||
const limit = Number(searchParams.get("limit") || "500");
|
||||
|
||||
const cfg = MAP[key];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue