correct link generation

This commit is contained in:
Johannes Kirschbauer 2024-01-10 13:18:37 +01:00 committed by Johannes Kirschbauer
parent 4e54cf5989
commit 4eb74208df

View File

@ -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);
}