From da4036e65383c935b4f1c0e94ea21875da0c11a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20H=C3=A5rek=20Andreassen?= Date: Sun, 7 Apr 2024 00:18:33 +0200 Subject: [PATCH] chore: Make compatiable with not throwing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Tim HÄrek Andreassen --- routes/index.tsx | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/routes/index.tsx b/routes/index.tsx index 1d04993..288810d 100644 --- a/routes/index.tsx +++ b/routes/index.tsx @@ -7,18 +7,18 @@ import SeriesCard from "../components/SeriesCard.tsx"; import { nrkRadio, SearchResultList } from "../lib/nrk.ts"; import { CSS, render } from "$gfm"; -interface HandlerData { +type Props = { query: string; origin: string; rawMarkdown: string; - result?: SearchResultList; -} + result?: SearchResultList | null; +}; -export const handler: Handlers = { +export const handler: Handlers = { async GET(request, ctx) { const url = new URL(request.url); const query = url.searchParams.get("query"); - let result: SearchResultList | undefined; + let result: Props["result"]; if (query) { result = await nrkRadio.search(query); } @@ -27,7 +27,7 @@ export const handler: Handlers = { }, }; -export default function Home({ data }: PageProps) { +export default function Home({ data }: PageProps) { return ( <> @@ -57,7 +57,7 @@ export default function Home({ data }: PageProps) { ); } -function SearchResult({ result, origin }: { result: SearchResultList; origin: string }) { +function SearchResult({ result, origin }: { result: Props["result"]; origin: string }) { if (!result) { return null; }