diff --git a/src/routes/search/+page.svelte b/src/routes/search/+page.svelte
index 0cd41dbf..f3601d3c 100644
--- a/src/routes/search/+page.svelte
+++ b/src/routes/search/+page.svelte
@@ -5,29 +5,31 @@
import type { SubmitFunction } from "@sveltejs/kit";
import type { PageData } from "./$types";
- let visitedValue = "all";
- let typeValue = "";
+ // let visitedValue = "all";
+ // let typeValue = "";
export let data: PageData;
let adventureArray: Adventure[] = data.props?.adventures as Adventure[];
const filter: SubmitFunction = async ({ formData }) => {
- visitedValue = formData.get("visited") as string;
- typeValue = formData.get("type") as string;
+ const radioValue = formData.get("visited") as string;
+ let typeValue = formData.get("type") as string;
+ if (!typeValue) {
+ typeValue = "";
+ }
const value = new URLSearchParams(location.search).get("value");
-
+ console.log(value);
console.log(
- `/api/search?value=${value}&type=${typeValue}&visited=${visitedValue}`
+ `/api/search?value=${value}&type=${typeValue}&visited=${radioValue}`
);
-
- let response = await fetch(
- `/api/search?value=${value}&type=${typeValue}&visited=${visitedValue}`
+ let data = await fetch(
+ `/api/search?value=${value}&type=${typeValue}&visited=${radioValue}`
);
- console.log(response);
-
- let res = await response.json();
+ console.log(data);
+ adventureArray = [];
+ let res = await data.json();
adventureArray = res.adventures as Adventure[];
- console.log("TEST" + visitedValue + " " + typeValue);
+ console.log(radioValue);
};
@@ -37,46 +39,32 @@
type="radio"
name="visited"
value="all"
+ checked
class="radio radio-primary"
- bind:group={visitedValue}
- checked={visitedValue === "all"}
/>
All
Not Visited
Visited
-
+
All
Activity
Location
-
+
Name