(path = currentPath)
| 229 | useEffect(() => { setActiveIndex(0); }, [filter, currentPath]); |
| 230 | |
| 231 | const submit = async (path = currentPath) => { |
| 232 | if (!path) return; |
| 233 | setSubmitting(true); setError(null); |
| 234 | try { |
| 235 | const body: { root_path: string; project_name?: string } = { root_path: path }; |
| 236 | if (projectName.trim()) body.project_name = projectName.trim(); |
| 237 | const res = await fetch("/api/index", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify(body) }); |
| 238 | const data = await res.json(); |
| 239 | if (!res.ok) throw new Error(data.error ?? "Failed"); |
| 240 | onCreated(); onClose(); |
| 241 | } catch (e) { setError(e instanceof Error ? e.message : "Failed"); } |
| 242 | finally { setSubmitting(false); } |
| 243 | }; |
| 244 | |
| 245 | const onFilterKeyDown = (e: React.KeyboardEvent<HTMLInputElement>) => { |
| 246 | if (e.key === "ArrowDown") { |
no outgoing calls
no test coverage detected