feat: use new db site, cache requests to avoid repeated unneeded fetch calls
This commit is contained in:
+3
-4
@@ -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(() => {
|
||||
|
||||
Reference in New Issue
Block a user