import { h } from "../jsx.ts"; import watt, { watt as originalWatt } from "../wattpad.ts"; import Base from "../templates/Base.tsx"; import Script from "../components/Script.tsx"; import FavoriteSearchButtonScript from "../scripts/FavoriteSearch.ts"; function search() { console.log(document.getElementById("query")); } export default async (params: URLSearchParams) => { const res = []; if (params.get("query") && params.get("type")) { const search = originalWatt.search({ query: params.get("type") === "tag" ? (params.get("query") as string).split(",") : (params.get("query") as string), type: params.get("type") as "text" | "title" | "tag", //cannot go wrong, will not go wrong, has never gone wrong limit: 20, sort: (params.get("sort") as string) ?? "hot" // migration trol }); await search.update(Number(params.get("page") ?? 0)); for (let i = 0; i < search.results.length; i++) { const rizz = await watt.getStory(search.results[i].id, false); res.push(

{rizz.name}

{rizz.storyJSON.description}

); } } return (