feat: use new db site, cache requests to avoid repeated unneeded fetch calls

This commit is contained in:
2026-06-18 23:20:12 -03:00
parent 9f5b8cd1fa
commit 6a064d295e
8 changed files with 64 additions and 35 deletions
+3 -4
View File
@@ -6,6 +6,7 @@ import shared from '../../styles/shared.module.css';
import styles from '../../styles/Dlcs.module.css';
import { PlatformFilter, isOnSteam, isOnEpic, isOnXbox, matchesPlatform, } from './types';
import { DLC, isNamedDLC } from '@/lib/utils';
import { fetchDLCs } from '@/lib/db';
const PLATFORM_FILTER_LABELS: Record<PlatformFilter, string> = { all: 'All', steam: 'Steam', epic: 'Epic', xbox: 'Xbox' };
@@ -18,10 +19,8 @@ export default function DlcsPage() {
const [statusFilter, setStatusFilter] = useState<'all' | 'unlocked' | 'locked'>('all');
useEffect(() => {
fetch('/data/dlcs.json')
.then(r => r.json())
.then((data: DLC[]) => setAllDlcs(data.filter(isNamedDLC)))
.catch(() => []);
fetchDLCs()
.then((data: DLC[]) => setAllDlcs(data.filter(isNamedDLC)));
}, []);
const filtered = useMemo(() => {