From 4eb74208df008b0967142c3a14c805d6f917202d Mon Sep 17 00:00:00 2001 From: Johannes Kirschbauer Date: Wed, 10 Jan 2024 13:18:37 +0100 Subject: [PATCH] correct link generation --- website/src/components/searchInput/searchInput.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/website/src/components/searchInput/searchInput.tsx b/website/src/components/searchInput/searchInput.tsx index edd2532..14b8888 100644 --- a/website/src/components/searchInput/searchInput.tsx +++ b/website/src/components/searchInput/searchInput.tsx @@ -81,7 +81,12 @@ export function SearchInput(props: SearchInputProps) { if (reason === "reset" && e) { console.log({ e, value, reason }); if (value) { - router.push(`/f/${value.split(".").join("/")}`.split(" ")[0]); + const target = data.find((d) => d.meta.title === value); + if (target) { + router.push(`/f/${target.meta.path.join("/")}`); + } else { + handleSubmit(value); + } } else { handleSubmit(value); }