submit 'type' fixes

This commit is contained in:
makearmy 2025-09-28 23:57:51 -04:00
parent aa8436da93
commit abec600bb6

View file

@ -107,13 +107,14 @@ function useOptions(path: string) {
});
};
}
} else if (rawPath === "repeater-choices") {
// target=<collection>, group=<repeater field>, field=<child field>
const group = params.get("group") || "";
const field = params.get("field") || "";
const collection = params.get("target") || "";
// Call our server proxy so it can use the server token
// Use server proxy so it can auth with server token
const proxyUrl = `/api/directus/fields?collection=${encodeURIComponent(collection)}`;
const metaRes = await fetch(proxyUrl, { cache: "no-store" });
if (!metaRes.ok) throw new Error(`Proxy ${metaRes.status} fetching ${proxyUrl}`);
@ -146,8 +147,14 @@ function useOptions(path: string) {
setLoading(false);
}
return; // short-circuit
} else {
// unknown path → empty
setOpts([]);
setLoading(false);
return;
}
} else {
// unknown path → empty
setOpts([]);