import { useEffect, useState } from "preact/hooks"; import { Loader } from "../components/Loader.tsx"; import { Button } from "../components/Button.tsx"; import { ModrinthGameVersion } from "../lib/modrinth.ts"; export function ForgeVersions() { const [game, setGame] = useState([]); const [isLoading, setIsLoading] = useState(true); const [includeSnapshots, setIncludeSnapshots] = useState(false); useEffect(() => { let poll: number; if (isLoading) { poll = setInterval(async () => { const res = await fetch("/api/forge"); if (res.status !== 200) return; const json: { gameVersions: ModrinthGameVersion[]; } = await res.json(); setGame(json.gameVersions); setIsLoading(false); }, 500); } return () => clearInterval(poll); }, [isLoading]); return isLoading ? : (

); }