web search done right
bang redirect in new frontend
Mikkel Denker83fd76c63bf1
diff --git a/frontend/src/lib/api/index.ts b/frontend/src/lib/api/index.tsindex d5795364..2a12885d 100644--- a/frontend/src/lib/api/index.ts+++ b/frontend/src/lib/api/index.ts@@ -7,6 +7,7 @@ import { send, sse, type Props, API_BASE, type ApiOptions } from './com';export const api = {search: (props: Props<'/beta/api/search', 'post'>, options?: ApiOptions) => {const { data, cancel } = send('/beta/api/search', 'post', 'json', props, options);+return { data: data.then((res) => res[200]), cancel };},diff --git a/frontend/src/routes/search/+page.ts b/frontend/src/routes/search/+page.tsindex 02987179..52f2891b 100644--- a/frontend/src/routes/search/+page.ts+++ b/frontend/src/routes/search/+page.ts@@ -26,6 +26,10 @@ export const load: PageLoad = async ({ fetch, url }) => {);const results = await data;+ if (results.type == "bang") {+ throw redirect(300, results.redirectTo);+ }+const prevPageSearchParams = match(params.currentPage > 1).with(true, () => {const newParams = new URLSearchParams(url.searchParams);