Skip to content

Commit

Permalink
Search
Browse files Browse the repository at this point in the history
  • Loading branch information
allanlasser committed Apr 11, 2024
1 parent 83f7a0f commit cb0be34
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/routes/app/add-ons/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,15 @@
goto(url);
}
function search(event: SubmitEvent) {
const { url } = data;
const formData = new FormData(event.currentTarget as HTMLFormElement);
const query = formData.get("query") ?? "";
if (!query) return;
url.searchParams.set("query", query);
goto(url);
}
$: active =
Array.from((data.url as URL).searchParams.entries()).find(
([_, value]) => value === "true",
Expand All @@ -45,7 +54,7 @@
<svelte:fragment slot="content">
<ContentLayout>
<PageToolbar slot="header">
<Search name="query" {query} slot="center" />
<Search name="query" {query} on:submit={search} slot="center" />
</PageToolbar>

{#if active === "active"}
Expand Down

0 comments on commit cb0be34

Please sign in to comment.