New search api refactoring

This commit is contained in:
Sean Morley
2024-06-03 23:10:08 +00:00
parent 2a5c7c12b1
commit 50a2cbcd4c
4 changed files with 117 additions and 102 deletions

View File

@@ -18,16 +18,20 @@
onMount(() => {
if (window.location.pathname === "/search") {
searchVal = new URLSearchParams(window.location.search).get("all") || "";
searchVal =
new URLSearchParams(window.location.search).get("value") || "";
}
});
async function goToSearch() {
if (searchVal === "") {
return;
}
let reload: boolean = false;
if (window.location.pathname === "/search") {
reload = true;
}
await goto("/search?all=" + searchVal);
await goto("/search?value=" + searchVal);
if (reload) {
location.reload();
}