chore: Make compatiable with not throwing

Signed-off-by: Tim Hårek Andreassen <tim@harek.no>
This commit is contained in:
Tim Hårek Andreassen 2024-04-07 00:18:33 +02:00
parent f30497a76b
commit da4036e653
No known key found for this signature in database
GPG Key ID: E59C7734F0E10EB5
1 changed files with 7 additions and 7 deletions

View File

@ -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<HandlerData> = {
export const handler: Handlers<Props> = {
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<HandlerData> = {
},
};
export default function Home({ data }: PageProps<HandlerData>) {
export default function Home({ data }: PageProps<Props>) {
return (
<>
<Head>
@ -57,7 +57,7 @@ export default function Home({ data }: PageProps<HandlerData>) {
);
}
function SearchResult({ result, origin }: { result: SearchResultList; origin: string }) {
function SearchResult({ result, origin }: { result: Props["result"]; origin: string }) {
if (!result) {
return null;
}