generated from Dicken/dickendock
round26: Ping vor Portscan, Liste neuer Dienste, Suchmaschinen-Integration (OpenSearch), API-Scanner
This commit is contained in:
25
apps/frontend/src/hooks/useDetectedApis.ts
Normal file
25
apps/frontend/src/hooks/useDetectedApis.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import { useQuery } from "@tanstack/react-query";
|
||||
|
||||
export interface DetectedApiEntry {
|
||||
id: string;
|
||||
serviceId: string;
|
||||
path: string;
|
||||
type: string;
|
||||
status: number;
|
||||
detectedAt: string;
|
||||
}
|
||||
|
||||
async function fetchDetectedApis(): Promise<DetectedApiEntry[]> {
|
||||
const res = await fetch("/api/detected-apis");
|
||||
if (!res.ok) {
|
||||
throw new Error(`APIs konnten nicht geladen werden (HTTP ${res.status})`);
|
||||
}
|
||||
return res.json();
|
||||
}
|
||||
|
||||
export function useDetectedApis() {
|
||||
return useQuery({
|
||||
queryKey: ["detected-apis"],
|
||||
queryFn: fetchDetectedApis,
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user