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
+6 -5
View File
@@ -4,6 +4,7 @@ import { useState, useEffect, useMemo } from 'react';
import { useInventoryStore } from '@/store/useInventoryStore';
import styles from '../styles/Home.module.css';
import { isNamedDLC } from '@/lib/utils';
import { fetchCharacters, fetchItems, fetchOfferings, fetchCustomizations, fetchDLCs } from '@/lib/db';
export default function Home() {
const store = useInventoryStore();
@@ -18,11 +19,11 @@ export default function Home() {
useEffect(() => {
Promise.all([
fetch('/data/characters.json').then(r => r.json()).catch(() => []),
fetch('/data/items.json').then(r => r.json()).catch(() => []),
fetch('/data/offerings.json').then(r => r.json()).catch(() => []),
fetch('/data/customization_items.json').then(r => r.json()).catch(() => []),
fetch('/data/dlcs.json').then(r => r.json()).catch(() => [])
fetchCharacters(),
fetchItems(),
fetchOfferings(),
fetchCustomizations(),
fetchDLCs()
]).then(([chars, items, offerings, customizations, dlcs]) => {
setCharCount(chars.length);
setItemsCount(items.length);