diff --git a/src/routes/search/+page.svelte b/src/routes/search/+page.svelte index f3601d3..9d0261b 100644 --- a/src/routes/search/+page.svelte +++ b/src/routes/search/+page.svelte @@ -5,8 +5,29 @@ import type { SubmitFunction } from "@sveltejs/kit"; import type { PageData } from "./$types"; - // let visitedValue = "all"; - // let typeValue = ""; + let typeValue: string = ""; + let visitedValue: string = "all"; + + async function filterResults() { + console.log(typeValue); + console.log(visitedValue); + + if (!typeValue) { + typeValue = ""; + } + const value = new URLSearchParams(location.search).get("value"); + console.log(value); + console.log( + `/api/search?value=${value}&type=${typeValue}&visited=${visitedValue}` + ); + let data = await fetch( + `/api/search?value=${value}&type=${typeValue}&visited=${visitedValue}` + ); + console.log(data); + adventureArray = []; + let res = await data.json(); + adventureArray = res.adventures as Adventure[]; + } export let data: PageData; let adventureArray: Adventure[] = data.props?.adventures as Adventure[]; @@ -34,51 +55,73 @@
-
- - All - - Not Visited - - Visited +

Filtering Options

+
+
+ + + +

- - All - - Activity - - Location - - Name - - - +
+ + + + +
+ +
+

Search Results

{#if adventureArray.length > 0}