From 80c339658a00f10eaaed23fa25da0de1ccc26c44 Mon Sep 17 00:00:00 2001 From: Lukas <69743171+quick007@users.noreply.github.com> Date: Sat, 23 Dec 2023 15:55:46 -0800 Subject: [PATCH] Update tickets.tsx --- routes/events/[id]/tickets.tsx | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/routes/events/[id]/tickets.tsx b/routes/events/[id]/tickets.tsx index 1987f49..fb8193c 100644 --- a/routes/events/[id]/tickets.tsx +++ b/routes/events/[id]/tickets.tsx @@ -24,6 +24,7 @@ export default defineRoute( const url = new URL(req.url); const queryValue = url.searchParams.get("q"); const showTimeID = url.searchParams.get("id") ?? event.showTimes[0].id; + const page = url.searchParams.get("p") ?? 0; let sortValue = parseInt(url.searchParams.get("s") ?? "0"); if (isNaN(sortValue) || sortValue > 4 || sortValue < 0) { @@ -35,13 +36,19 @@ export default defineRoute( const request = ["ticket", eventID]; if (showTimeID !== "0") request.push(showTimeID); - - const tix = kv.list({ prefix: request }); - const tickets: Deno.KvEntry[] = []; + const pageSize = 1 + const tix = kv.list({ prefix: request, }) + let tickets: Deno.KvEntry[] = []; for await (const ticket of tix) { tickets.push(ticket); } + if (queryValue) { + tickets = tickets.filter((ticket) => ticket.value.firstName.includes(queryValue) || ticket.value.lastName.includes(queryValue) || ticket.value.userEmail.includes(queryValue) || ticket.key[3]) + } + + console.log(ticket.key[3]) + return (