import type { PageLoad } from './$types'; import type { Feed } from '#lib/api/Feed.ts'; import type { Search } from '#lib/api/Search.ts'; import { data } from '#lib/data.ts'; /** Asked for `q`, the repositories that match it; else what happened. Neither, without an index. */ export const load: PageLoad = async (event) => { const q = event.url.searchParams.get('q'); if (q !== null) { const search = await data(event, `/_data/search?q=${encodeURIComponent(q)}`, true); if (search) return { search, feed: null }; } const feed = await data(event, '/xrpc/dev.knotless.getFeed', true); return { search: null, feed }; };