Fix autocomplete

This commit is contained in:
MeowcaTheoRange 2024-04-15 08:18:01 -05:00
parent d8eaaba9c9
commit 458f4a66ee
2 changed files with 13 additions and 1 deletions

View file

@ -0,0 +1,12 @@
import { NextRequest } from "next/server";
import { stringify } from "node:querystring";
export async function GET(request: NextRequest) {
return Response.json(
await fetch(
`https://s.abtmtr.link/autocompleter?${stringify({
q: request.nextUrl.searchParams.get("q")
})}`
).then(x => x.json())
);
}

View file

@ -25,7 +25,7 @@ export default function Searchbar({value}:{value?:string}) {
async function executeAC(e:FormEvent<HTMLInputElement>) {
const target = e.target as HTMLInputElement;
console.log(target.value);
const rows = await fetch(`https://s.abtmtr.link/autocompleter?${stringify({
const rows = await fetch(`/search/autocompleter?${stringify({
q: target.value
})}`).then(x => x.json());
if (rows == null) return;