Commit 6: Adminbereich (TanStack Router, 8 Menüpunkte, Scan-Logs)

This commit is contained in:
2026-07-19 02:53:04 +02:00
parent b0ff551ca0
commit 2f31996bbb
31 changed files with 1693 additions and 112 deletions

View File

@@ -0,0 +1,21 @@
import { useQuery } from "@tanstack/react-query";
import type { Device, Service } from "@launchpad/shared";
export interface DeviceWithServices extends Device {
services: Service[];
}
async function fetchDevices(): Promise<DeviceWithServices[]> {
const res = await fetch("/api/devices");
if (!res.ok) {
throw new Error(`Geräte konnten nicht geladen werden (HTTP ${res.status})`);
}
return res.json();
}
export function useDevices() {
return useQuery({
queryKey: ["devices"],
queryFn: fetchDevices,
});
}