Add pocketbase types

This commit is contained in:
2025-06-15 18:09:13 +02:00
parent ec663fba55
commit 6ba59430db
8 changed files with 218 additions and 46 deletions

View File

@@ -7,11 +7,7 @@ import { Button } from "@/components/ui/button";
import { RefreshCw, AlertCircle, Radar } from "lucide-react";
import { SignatureListItem } from "@/components/SignatureListItem";
import { toast } from "@/hooks/use-toast";
import { Signature } from "@/lib/types";
interface ApiResponse {
items: Signature[];
}
import pb from "@/lib/pocketbase";
interface SystemTrackerProps {
system: string;
@@ -27,19 +23,7 @@ export const SystemTracker = ({ system }: SystemTrackerProps) => {
queryKey: ['signatures', system],
queryFn: async () => {
if (!system) return null;
const encodedSystem = encodeURIComponent(system);
const url = `https://evebase.site.quack-lab.dev/api/collections/sigview/records?filter=(system%3D'${encodedSystem}')`;
console.log('Fetching signatures for system:', system);
console.log('API URL:', url);
const response = await fetch(url);
if (!response.ok) {
throw new Error('Failed to fetch signatures');
}
const data: ApiResponse = await response.json();
return data;
return pb.collection('sigview').getFullList({ batch: 1000, filter: `(system='${system}')` });
},
enabled: !!system,
refetchInterval: 5000, // Poll every 5 seconds
@@ -53,7 +37,7 @@ export const SystemTracker = ({ system }: SystemTrackerProps) => {
});
};
const signatures = signaturesData?.items || [];
const signatures = signaturesData || [];
const isLoading = signaturesLoading;
// Sort signatures by date (newest first) and prioritize unknown types