Commit 3: Suche im Frontend mit echten Backend-Daten, Ranking, Tastatur-Navigation

This commit is contained in:
2026-07-19 02:00:13 +02:00
parent a5b998b421
commit f963f7eb4e
10 changed files with 224 additions and 16 deletions

View File

@@ -0,0 +1,17 @@
import { useQuery } from "@tanstack/react-query";
import type { Service } from "@launchpad/shared";
async function fetchServices(): Promise<Service[]> {
const res = await fetch("/api/services");
if (!res.ok) {
throw new Error(`Dienste konnten nicht geladen werden (HTTP ${res.status})`);
}
return res.json();
}
export function useServices() {
return useQuery({
queryKey: ["services"],
queryFn: fetchServices,
});
}